{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-communication-services/json-schema/microsoft-azure-communication-services-purchased-phone-number-schema.json",
  "title": "PurchasedPhoneNumber",
  "description": "Represents a purchased phone number.",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-communication-services-phonenumbers-api-openapi.yml#/components/schemas/PurchasedPhoneNumber",
  "required": [
    "assignmentType",
    "capabilities",
    "cost",
    "countryCode",
    "id",
    "phoneNumber",
    "phoneNumberType",
    "purchaseDate"
  ],
  "type": "object",
  "properties": {
    "id": {
      "description": "The id of the phone number, e.g. 11234567890.",
      "type": "string"
    },
    "phoneNumber": {
      "description": "String of the E.164 format of the phone number, e.g. +11234567890.",
      "type": "string"
    },
    "countryCode": {
      "description": "The ISO 3166-2 code of the phone number's country, e.g. US.",
      "type": "string"
    },
    "phoneNumberType": {
      "description": "The phone number's type, e.g. geographic, tollFree, mobile.",
      "enum": [
        "geographic",
        "tollFree",
        "mobile"
      ],
      "type": "string",
      "x-ms-enum": {
        "name": "PhoneNumberType",
        "modelAsString": true
      }
    },
    "capabilities": {
      "$ref": "#/$defs/PhoneNumberCapabilities"
    },
    "assignmentType": {
      "description": "The assignment type of the phone number. A phone number can be assigned to a person, or to an application.",
      "enum": [
        "person",
        "application"
      ],
      "type": "string",
      "x-ms-enum": {
        "name": "PhoneNumberAssignmentType",
        "modelAsString": true
      }
    },
    "purchaseDate": {
      "format": "date-time",
      "description": "The date and time that the phone number was purchased.",
      "type": "string"
    },
    "cost": {
      "$ref": "#/$defs/PhoneNumberCost"
    }
  },
  "$defs": {
    "PhoneNumberCapabilities": {
      "description": "Capabilities of a phone number.",
      "required": [
        "calling",
        "sms"
      ],
      "type": "object",
      "properties": {
        "calling": {
          "description": "Capability value for calling.",
          "enum": [
            "none",
            "inbound",
            "outbound",
            "inbound+outbound"
          ],
          "type": "string",
          "x-ms-enum": {
            "name": "PhoneNumberCapabilityType",
            "modelAsString": true
          }
        },
        "sms": {
          "description": "Capability value for SMS.",
          "enum": [
            "none",
            "inbound",
            "outbound",
            "inbound+outbound"
          ],
          "type": "string",
          "x-ms-enum": {
            "name": "PhoneNumberCapabilityType",
            "modelAsString": true
          }
        }
      }
    },
    "PhoneNumberCost": {
      "description": "The incurred cost for a single phone number.",
      "required": [
        "amount",
        "billingFrequency",
        "currencyCode"
      ],
      "type": "object",
      "properties": {
        "amount": {
          "format": "double",
          "description": "The cost amount.",
          "type": "number"
        },
        "currencyCode": {
          "description": "The ISO 4217 currency code for the cost amount, e.g. USD.",
          "type": "string"
        },
        "billingFrequency": {
          "description": "The frequency with which the cost gets billed.",
          "enum": [
            "monthly"
          ],
          "type": "string",
          "x-ms-enum": {
            "name": "BillingFrequency",
            "modelAsString": true
          }
        }
      }
    }
  }
}