{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/telenor-sverige/json-schema/telenor-sverige-order-request-schema.json",
  "title": "OrderRequest",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/telenor-sverige-fixed-network-order-openapi.yml#/components/schemas/OrderRequest",
  "type": "object",
  "properties": {
    "externalId": {
      "type": "string",
      "description": "The ID of the order that's generated and stored in a client's system.",
      "maxLength": 100
    },
    "notes": {
      "type": "string",
      "description": "General notes that are applicable for all items in the order.",
      "maxLength": 4000,
      "minLength": 0
    },
    "agreementId": {
      "type": "integer",
      "format": "int32",
      "description": "The agreement to which this order should belong."
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ItemRequest"
      },
      "minItems": 1
    }
  },
  "required": [
    "agreementId",
    "items"
  ],
  "$defs": {
    "AdditionalService": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the additional service from Product Catalog."
        },
        "parameters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AdditionalServiceParameter"
          }
        },
        "notes": {
          "type": "string",
          "description": "Notes associated to the additional service.",
          "maxLength": 4000,
          "minLength": 0
        },
        "switchInformation": {
          "$ref": "#/$defs/SwitchInformationDto",
          "description": "Information about switch installation. Should be populated if additionalService is a switch."
        }
      },
      "required": [
        "id"
      ]
    },
    "AdditionalServiceParameter": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the additional service parameter from Product Catalog."
        }
      },
      "required": [
        "id"
      ]
    },
    "Billing": {
      "type": "object",
      "properties": {
        "costCenter": {
          "type": "string",
          "description": "The cost center to be billed.",
          "maxLength": 50,
          "minLength": 0
        },
        "invoiceAccount": {
          "type": "string",
          "description": "The invoice account to be billed.",
          "maxLength": 50,
          "minLength": 0
        },
        "referenceNumber": {
          "type": "string",
          "description": "A reference number to be used in the invoice.",
          "maxLength": 100,
          "minLength": 0
        },
        "phoneNumber": {
          "type": "string",
          "description": "The phone number of the billing location.",
          "maxLength": 20,
          "minLength": 0
        },
        "customerName": {
          "type": "string",
          "description": "The name of the company at the billing location.",
          "maxLength": 50,
          "minLength": 0
        },
        "organisationNumber": {
          "type": "string",
          "description": "The organisation number of the invoice account in case it's different from the main one.",
          "maxLength": 20,
          "minLength": 0
        },
        "projectNumber": {
          "type": "string",
          "description": "The project number associated to the order.",
          "maxLength": 30
        },
        "inxNumber": {
          "type": "string",
          "description": "The INX number associated to the order.",
          "maxLength": 30
        },
        "invoiceLabel": {
          "type": "string",
          "description": "The invoice label.",
          "maxLength": 100
        },
        "address": {
          "$ref": "#/$defs/BillingAddress"
        }
      }
    },
    "BillingAddress": {
      "type": "object",
      "properties": {
        "address1": {
          "type": "string",
          "description": "The address of the billing location.",
          "maxLength": 100,
          "minLength": 0
        },
        "address2": {
          "type": "string",
          "description": "A complement to the address.",
          "maxLength": 100,
          "minLength": 0
        },
        "postalCode": {
          "type": "string",
          "description": "The postal code for the address.",
          "maxLength": 20,
          "minLength": 0
        },
        "city": {
          "type": "string",
          "description": "The city where the address is located.",
          "maxLength": 100,
          "minLength": 0
        },
        "country": {
          "type": "string",
          "description": "The country where the address is located.",
          "maxLength": 100,
          "minLength": 0
        }
      }
    },
    "ContactPerson": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "deprecated": true,
          "description": "The full name of the person to be contacted. The field is deprecated, \"firstName\" and \"lastName\" should be used instead."
        },
        "firstName": {
          "type": "string",
          "description": "The first name of the person to be contacted.\nRequired field if contact role is not PLANNED_WORK.\n"
        },
        "lastName": {
          "type": "string",
          "description": "The last name of the person to be contacted."
        },
        "email": {
          "type": "string",
          "format": "email",
          "description": "The e-mail address of the contact person."
        },
        "phoneNumber": {
          "type": "string",
          "description": "The phone number of the person to be contacted.\nPhone number should consist only of digits, spaces, dashes with optional leading plus.\nRequired field if mobileNumber is not present and contact role is not PLANNED_WORK.",
          "maxLength": 20,
          "minLength": 0
        },
        "mobileNumber": {
          "type": "string",
          "description": "The mobile number of the person to be contacted.\nMobile number should consist only of digits, spaces, dashes with optional leading plus.\nRequired field if phoneNumber is not present and contact role is not PLANNED_WORK.",
          "maxLength": 20,
          "minLength": 0
        },
        "type": {
          "type": "string",
          "description": "Represents the type of information the person can provided when contacted.",
          "enum": [
            "GENERAL",
            "LOCAL_CONTACT",
            "TECHNICAL",
            "PLANNED_WORK",
            "ALARM_CONTACT"
          ]
        }
      },
      "required": [
        "email"
      ]
    },
    "Coordinates": {
      "type": "object",
      "description": "The RT90 coordinates where the site is located or will be located.",
      "properties": {
        "rt90X": {
          "type": "integer",
          "format": "int32",
          "description": "The X value using the RT90 standard."
        },
        "rt90Y": {
          "type": "integer",
          "format": "int32",
          "description": "The Y value using the RT90 standard."
        }
      },
      "required": [
        "rt90X",
        "rt90Y"
      ]
    },
    "ItemRequest": {
      "type": "object",
      "properties": {
        "externalId": {
          "type": "string",
          "description": "The ID of the item that's generated and stored in a client's system.",
          "maxLength": 100
        },
        "quotationId": {
          "type": "string",
          "format": "uuid",
          "description": "The ID of an existing quotation response. If specified, Binding time, Site and Product will be ignored."
        },
        "orderType": {
          "type": "string",
          "description": "The order type for this item. Leave blank for quotation based order items. {@link OrderType.NEW} is default and should be used when ordering on a new site. Use {@link OrderType.ADD} when ordering a product that will be added to an existing product. Use {@link OrderType.MIGRATION} when ordering a product that will replace an existing product.",
          "enum": [
            "NEW",
            "ADD",
            "MIGRATION"
          ]
        },
        "site": {
          "$ref": "#/$defs/Site"
        },
        "contactPersons": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ContactPerson"
          },
          "minItems": 1
        },
        "product": {
          "$ref": "#/$defs/Product"
        },
        "billing": {
          "$ref": "#/$defs/Billing"
        },
        "bindingTime": {
          "type": "integer",
          "format": "int32",
          "description": "The binding time (in months) for this order item. Required if no quotationId is provided.",
          "maximum": 60,
          "minimum": 0
        },
        "desiredInstallationDate": {
          "type": "string",
          "format": "date-time",
          "description": "A desired date and time for when the product should be installed on the site."
        },
        "migrationInformation": {
          "$ref": "#/$defs/MigrationInformationDto",
          "description": "Information about entity that is being replaced if this is migration order.\nCan only be used with direct orders."
        },
        "notes": {
          "type": "string",
          "description": "General notes associated to the order item.",
          "maxLength": 4000,
          "minLength": 0
        }
      },
      "required": [
        "contactPersons"
      ]
    },
    "MigrationInformationDto": {
      "type": "object",
      "properties": {
        "migratedReferenceType": {
          "type": "string",
          "description": "Type of entity that is going to be replaced.",
          "enum": [
            "OTHER",
            "SID"
          ]
        },
        "migratedReference": {
          "type": "string",
          "description": "Reference to entity that is being replaced.",
          "maxLength": 100,
          "minLength": 0
        }
      },
      "required": [
        "migratedReference",
        "migratedReferenceType"
      ]
    },
    "Product": {
      "type": "object",
      "description": "The product information. Required if no quotationId is provided.",
      "properties": {
        "productOfferingId": {
          "type": "integer",
          "format": "int32",
          "description": "The Product Offering ID from Product Catalog."
        },
        "additionalServices": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AdditionalService"
          }
        },
        "notes": {
          "type": "string",
          "description": "General notes associated to the product.",
          "maxLength": 4000,
          "minLength": 0
        },
        "qualityOfServiceId": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the desired Quality of Service from Product Catalog."
        },
        "accessRedundancyId": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the desired Access Redundancy from Product Catalog."
        },
        "accessTypeId": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the desired Access Type from Product Catalog."
        },
        "accessSpeedId": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the desired Access Speed from Product Catalog."
        },
        "serviceLevelAgreementId": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the desired Service Level Agreement (SLA) from Product Catalog."
        },
        "serviceLevelAgreementLevelId": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the desired Service Level Agreement (SLA) Level from Product Catalog."
        },
        "vlanConfiguration": {
          "type": "array",
          "description": "VLAN configuration for product.",
          "items": {
            "$ref": "#/$defs/VlanConfigurationDto"
          }
        }
      },
      "required": [
        "productOfferingId"
      ]
    },
    "Site": {
      "type": "object",
      "description": "The site where a product will be installed. Required if no quotationId is provided.",
      "properties": {
        "siteId": {
          "type": "string",
          "description": "The ID of the site that's generated by Telenor's internal systems."
        },
        "externalId": {
          "type": "string",
          "description": "The ID of the site that's generated and stored in a client's system. Underscores are not allowed.",
          "maxLength": 100,
          "minLength": 0
        },
        "siteName": {
          "type": "string",
          "description": "A name of the site such as a denoted name of the project site.",
          "maxLength": 200,
          "minLength": 0
        },
        "address1": {
          "type": "string",
          "description": "Street name, followed by street number.",
          "maxLength": 100,
          "minLength": 0
        },
        "apartmentNumber": {
          "type": "string",
          "description": "Apartment number of the site.",
          "maxLength": 20,
          "minLength": 0
        },
        "address2": {
          "type": "string",
          "description": "A complement to the address.",
          "maxLength": 100,
          "minLength": 0
        },
        "postalCode": {
          "type": "string",
          "description": "The postal code for the address.",
          "maxLength": 20,
          "minLength": 0
        },
        "city": {
          "type": "string",
          "description": "The city where the address is located.",
          "maxLength": 100,
          "minLength": 0
        },
        "country": {
          "type": "string",
          "description": "The country where the address is located.",
          "maxLength": 100,
          "minLength": 0
        },
        "notes": {
          "type": "string",
          "description": "Notes regarding the site.",
          "maxLength": 500,
          "minLength": 0
        },
        "organisationNumber": {
          "type": "string",
          "description": "The organisation number for the site, in case it differs from the general org number.",
          "maxLength": 20,
          "minLength": 0
        },
        "coordinates": {
          "$ref": "#/$defs/Coordinates"
        }
      }
    },
    "SwitchInformationDto": {
      "type": "object",
      "properties": {
        "placement": {
          "type": "string",
          "description": "The location where switch should be installed.",
          "maxLength": 100,
          "minLength": 0
        },
        "installationOrder": {
          "type": "integer",
          "format": "int32",
          "description": "Order in which switch should be installed. Switches with lowest values are listed first. Values should be unique for all switches within the product."
        }
      },
      "required": [
        "installationOrder",
        "placement"
      ]
    },
    "VlanConfigurationDto": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the VLAN. Each VLAN within the product should have unique name.",
          "enum": [
            "Vlan11",
            "Vlan12",
            "Vlan13",
            "Vlan14",
            "Vlan15",
            "Vlan16",
            "Vlan17",
            "Vlan18",
            "Vlan19",
            "VlanMgmt"
          ]
        },
        "ip": {
          "type": "string",
          "description": "IP address of the VLAN.",
          "maxLength": 40,
          "minLength": 0
        },
        "mask": {
          "type": "string",
          "description": "Subnet mask of the VLAN.",
          "maxLength": 40,
          "minLength": 0
        }
      },
      "required": [
        "ip",
        "mask",
        "name"
      ]
    }
  }
}