{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-communication-services/json-schema/microsoft-azure-communication-services-phone-number-search-result-schema.json",
  "title": "PhoneNumberSearchResult",
  "description": "The result of a phone number search operation.",
  "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/PhoneNumberSearchResult",
  "required": [
    "assignmentType",
    "capabilities",
    "cost",
    "phoneNumbers",
    "phoneNumberType",
    "searchExpiresBy",
    "searchId"
  ],
  "type": "object",
  "properties": {
    "searchId": {
      "description": "The search id.",
      "type": "string"
    },
    "phoneNumbers": {
      "description": "The phone numbers that are available. Can be fewer than the desired search quantity.",
      "type": "array",
      "items": {
        "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
      }
    },
    "assignmentType": {
      "description": "Phone number's assignment type.",
      "enum": [
        "person",
        "application"
      ],
      "type": "string",
      "x-ms-enum": {
        "name": "PhoneNumberAssignmentType",
        "modelAsString": true
      }
    },
    "capabilities": {
      "$ref": "#/$defs/PhoneNumberCapabilities"
    },
    "cost": {
      "$ref": "#/$defs/PhoneNumberCost"
    },
    "searchExpiresBy": {
      "format": "date-time",
      "description": "The date that this search result expires and phone numbers are no longer on hold. A search result expires in less than 15min, e.g. 2020-11-19T16:31:49.048Z.",
      "type": "string"
    },
    "isAgreementToNotResellRequired": {
      "description": "Indicates if do not resell agreement is required. If true, the phone numbers cannot be acquired unless the customer provides explicit agreement to not resell them.",
      "type": "boolean"
    },
    "errorCode": {
      "format": "int32",
      "description": "The error code of the search.",
      "type": "integer"
    },
    "error": {
      "description": "Mapping Error Messages to Codes",
      "enum": [
        "NoError",
        "UnknownErrorCode",
        "OutOfStock",
        "AuthorizationDenied",
        "MissingAddress",
        "InvalidAddress",
        "InvalidOfferModel",
        "NotEnoughLicenses",
        "NoWallet",
        "NotEnoughCredit",
        "NumbersPartiallyAcquired",
        "AllNumbersNotAcquired",
        "ReservationExpired",
        "PurchaseFailed",
        "BillingUnavailable",
        "ProvisioningFailed",
        "UnknownSearchError"
      ],
      "type": "string",
      "x-ms-enum": {
        "name": "Error",
        "modelAsString": true
      }
    }
  },
  "$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
          }
        }
      }
    }
  }
}