{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/telenor-sverige/json-schema/telenor-sverige-core-api-product-ordering-subscriptions-order-schema.json",
  "title": "CoreApi.ProductOrdering.Subscriptions.Order",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/telenor-sverige-productordering-api-openapi.yml#/components/schemas/CoreApi.ProductOrdering.Subscriptions.Order",
  "required": [
    "OrderItems"
  ],
  "type": "object",
  "properties": {
    "ExternalId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Represents a client defined id to uniquely identify the order"
    },
    "UserId": {
      "type": [
        "string",
        "null"
      ]
    },
    "OrderItems": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/CoreApi.ProductOrdering.Subscriptions.OrderSubscription"
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "CoreApi.ProductOrdering.Subscriptions.Address": {
      "required": [
        "City",
        "Type",
        "Zip"
      ],
      "type": "object",
      "properties": {
        "CompanyName": {
          "type": [
            "string",
            "null"
          ],
          "description": "Required for type 'Delivery'"
        },
        "Reference": {
          "type": [
            "string",
            "null"
          ]
        },
        "Address1": {
          "type": [
            "string",
            "null"
          ]
        },
        "Address2": {
          "type": [
            "string",
            "null"
          ]
        },
        "Zip": {
          "type": [
            "string",
            "null"
          ],
          "description": "For Swedish postal code it must only contain 5 digits"
        },
        "City": {
          "type": [
            "string",
            "null"
          ]
        },
        "CountryCode": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3"
        },
        "Type": {
          "enum": [
            "Legal",
            "Delivery",
            "Private",
            "Invoice",
            null
          ],
          "type": [
            "string",
            "null"
          ],
          "description": "Members [Legal=|Delivery=|Private=|Invoice=]"
        }
      },
      "additionalProperties": false
    },
    "CoreApi.ProductOrdering.Subscriptions.Billing": {
      "type": "object",
      "properties": {
        "BillingAccount": {
          "type": [
            "string",
            "null"
          ]
        },
        "GLN": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "CoreApi.ProductOrdering.Subscriptions.BindingPeriod": {
      "type": "object",
      "properties": {
        "Period": {
          "type": [
            "string",
            "null"
          ]
        },
        "Amount": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        }
      },
      "additionalProperties": false
    },
    "CoreApi.ProductOrdering.Subscriptions.EidOrder": {
      "type": "object",
      "properties": {
        "Value": {
          "type": [
            "string",
            "null"
          ]
        },
        "PushActivation": {
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "CoreApi.ProductOrdering.Subscriptions.ExternalPropertyOrderInput": {
      "required": [
        "Key"
      ],
      "type": "object",
      "properties": {
        "Action": {
          "type": [
            "string",
            "null"
          ]
        },
        "Key": {
          "maxLength": 128,
          "minLength": 0,
          "type": "string"
        },
        "Value": {
          "maxLength": 128,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "CoreApi.ProductOrdering.Subscriptions.MsisdnInput": {
      "type": "object",
      "properties": {
        "Number": {
          "type": [
            "string",
            "null"
          ]
        },
        "RangeId": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "DestinationCode": {
          "type": [
            "string",
            "null"
          ]
        },
        "PortDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "deprecated": true
        }
      },
      "additionalProperties": false
    },
    "CoreApi.ProductOrdering.Subscriptions.OrderServiceParameter": {
      "required": [
        "Key"
      ],
      "type": "object",
      "properties": {
        "Key": {
          "minLength": 1,
          "type": "string"
        },
        "Value": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "CoreApi.ProductOrdering.Subscriptions.OrderSubscription": {
      "required": [
        "Action"
      ],
      "type": "object",
      "properties": {
        "ExternalId": {
          "type": [
            "string",
            "null"
          ],
          "description": "Represents a client defined id to uniquely identify the order item within the order"
        },
        "AgreeId": {
          "type": "integer",
          "format": "int32"
        },
        "Action": {
          "enum": [
            "New",
            "Update",
            "Delete",
            "ServiceOrder",
            null
          ],
          "type": [
            "string",
            "null"
          ],
          "description": "Members [New=|Update=|Delete=|ServiceOrder=]"
        },
        "ProfileId": {
          "type": [
            "string",
            "null"
          ]
        },
        "Numbers": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/CoreApi.ProductOrdering.Subscriptions.MsisdnInput"
          }
        },
        "SimNumber": {
          "type": [
            "string",
            "null"
          ],
          "description": "Replaced by Sim.SimNumber in v2 API"
        },
        "Sim": {
          "$ref": "#/$defs/CoreApi.ProductOrdering.Subscriptions.Sim"
        },
        "BindingPeriod": {
          "$ref": "#/$defs/CoreApi.ProductOrdering.Subscriptions.BindingPeriod"
        },
        "CostCenter": {
          "maxLength": 20,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ]
        },
        "BillingAccount": {
          "type": [
            "string",
            "null"
          ],
          "description": "Replaced by Billing.BillingAccount in v2 API"
        },
        "Addresses": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/CoreApi.ProductOrdering.Subscriptions.Address"
          }
        },
        "Services": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/CoreApi.ProductOrdering.Subscriptions.SubscriptionOrderService"
          }
        },
        "IncPreSelectedServices": {
          "type": "boolean"
        },
        "ContactDetails": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "Meta": {
          "type": [
            "string",
            "null"
          ]
        },
        "Billing": {
          "$ref": "#/$defs/CoreApi.ProductOrdering.Subscriptions.Billing"
        },
        "ExternalProperties": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/CoreApi.ProductOrdering.Subscriptions.ExternalPropertyOrderInput"
          }
        }
      },
      "additionalProperties": false
    },
    "CoreApi.ProductOrdering.Subscriptions.Sim": {
      "type": "object",
      "properties": {
        "SimNumber": {
          "type": [
            "string",
            "null"
          ]
        },
        "ESim": {
          "type": "boolean"
        },
        "Eid": {
          "$ref": "#/$defs/CoreApi.ProductOrdering.Subscriptions.EidOrder"
        }
      },
      "additionalProperties": false
    },
    "CoreApi.ProductOrdering.Subscriptions.SubscriptionOrderService": {
      "required": [
        "Name"
      ],
      "type": "object",
      "properties": {
        "Name": {
          "type": [
            "string",
            "null"
          ]
        },
        "Parameters": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/CoreApi.ProductOrdering.Subscriptions.OrderServiceParameter"
          }
        }
      },
      "additionalProperties": false
    }
  }
}