{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/Subscription",
  "title": "Subscription",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "This is the unique identifier for the subscription."
    },
    "createdAt": {
      "format": "date-time",
      "type": "string",
      "description": "This is the timestamp when the subscription was created."
    },
    "updatedAt": {
      "format": "date-time",
      "type": "string",
      "description": "This is the timestamp when the subscription was last updated."
    },
    "type": {
      "type": "string",
      "description": "This is the type / tier of the subscription.",
      "enum": [
        "pay-as-you-go",
        "enterprise",
        "agency",
        "startup",
        "growth",
        "scale"
      ]
    },
    "status": {
      "type": "string",
      "description": "This is the status of the subscription. Past due subscriptions are subscriptions\nwith past due payments.",
      "enum": [
        "active",
        "frozen"
      ]
    },
    "credits": {
      "type": "string",
      "description": "This is the number of credits the subscription currently has.\n\nNote: This is a string to avoid floating point precision issues."
    },
    "concurrencyCounter": {
      "type": "number",
      "description": "This is the total number of active calls (concurrency) across all orgs under this subscription.",
      "minimum": 1
    },
    "concurrencyLimitIncluded": {
      "type": "number",
      "description": "This is the default concurrency limit for the subscription.",
      "minimum": 1
    },
    "phoneNumbersCounter": {
      "type": "number",
      "description": "This is the number of free phone numbers the subscription has",
      "minimum": 1
    },
    "phoneNumbersIncluded": {
      "type": "number",
      "description": "This is the maximum number of free phone numbers the subscription can have",
      "minimum": 1
    },
    "concurrencyLimitPurchased": {
      "type": "number",
      "description": "This is the purchased add-on concurrency limit for the subscription.",
      "minimum": 1
    },
    "monthlyChargeScheduleId": {
      "type": "number",
      "description": "This is the ID of the monthly job that charges for subscription add ons and phone numbers."
    },
    "monthlyCreditCheckScheduleId": {
      "type": "number",
      "description": "This is the ID of the monthly job that checks whether the credit balance of the subscription\nis sufficient for the monthly charge."
    },
    "stripeCustomerId": {
      "type": "string",
      "description": "This is the Stripe customer ID."
    },
    "stripePaymentMethodId": {
      "type": "string",
      "description": "This is the Stripe payment ID."
    },
    "slackSupportEnabled": {
      "type": "boolean",
      "description": "If this flag is true, then the user has purchased slack support."
    },
    "slackChannelId": {
      "type": "string",
      "description": "If this subscription has a slack support subscription, the slack channel's ID will be stored here."
    },
    "hipaaEnabled": {
      "type": "boolean",
      "description": "This is the HIPAA enabled flag for the subscription. It determines whether orgs under this\nsubscription have the option to enable HIPAA compliance."
    },
    "zdrEnabled": {
      "type": "boolean",
      "description": "This is the ZDR enabled flag for the subscription. It determines whether orgs under this\nsubscription have the option to enable ZDR."
    },
    "dataRetentionEnabled": {
      "type": "boolean",
      "description": "This is the data retention enabled flag for the subscription. It determines whether orgs under this\nsubscription have the option to enable data retention."
    },
    "hipaaCommonPaperAgreementId": {
      "type": "string",
      "description": "This is the ID for the Common Paper agreement outlining the HIPAA contract."
    },
    "stripePaymentMethodFingerprint": {
      "type": "string",
      "description": "This is the Stripe fingerprint of the payment method (card). It allows us\nto detect users who try to abuse our system through multiple sign-ups."
    },
    "stripeCustomerEmail": {
      "type": "string",
      "description": "This is the customer's email on Stripe."
    },
    "referredByEmail": {
      "type": "string",
      "description": "This is the email of the referrer for the subscription."
    },
    "autoReloadPlan": {
      "description": "This is the auto reload plan configured for the subscription.",
      "allOf": [
        {
          "$ref": "#/components/schemas/AutoReloadPlan"
        }
      ]
    },
    "minutesIncluded": {
      "type": "number",
      "description": "The number of minutes included in the subscription.",
      "minimum": 0
    },
    "minutesUsed": {
      "type": "number",
      "description": "The number of minutes used in the subscription.",
      "minimum": 0
    },
    "minutesUsedNextResetAt": {
      "format": "date-time",
      "type": "string",
      "description": "This is the timestamp at which the number of monthly free minutes is scheduled to reset at."
    },
    "minutesOverageCost": {
      "type": "number",
      "description": "The per minute charge on minutes that exceed the included minutes. Enterprise only."
    },
    "providersIncluded": {
      "description": "The list of providers included in the subscription. Enterprise only.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "outboundCallsDailyLimit": {
      "type": "number",
      "description": "The maximum number of outbound calls this subscription may make in a day. Resets every night.",
      "minimum": 1
    },
    "outboundCallsCounter": {
      "type": "number",
      "description": "The current number of outbound calls the subscription has made in the current day.",
      "minimum": 1
    },
    "outboundCallsCounterNextResetAt": {
      "format": "date-time",
      "type": "string",
      "description": "This is the timestamp at which the outbound calls counter is scheduled to reset at."
    },
    "couponIds": {
      "description": "This is the IDs of the coupons applicable to this subscription.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "couponUsageLeft": {
      "type": "string",
      "description": "This is the number of credits left obtained from a coupon."
    },
    "invoicePlan": {
      "description": "This is the invoice plan for the subscription.",
      "allOf": [
        {
          "$ref": "#/components/schemas/InvoicePlan"
        }
      ]
    },
    "pciEnabled": {
      "type": "boolean",
      "description": "This is the PCI enabled flag for the subscription. It determines whether orgs under this\nsubscription have the option to enable PCI compliance."
    },
    "pciCommonPaperAgreementId": {
      "type": "string",
      "description": "This is the ID for the Common Paper agreement outlining the PCI contract."
    },
    "callRetentionDays": {
      "type": "number",
      "description": "This is the call retention days for the subscription."
    },
    "chatRetentionDays": {
      "type": "number",
      "description": "This is the chat retention days for the subscription."
    },
    "minutesIncludedResetFrequency": {
      "type": "string",
      "description": "This is the minutes_included reset frequency for the subscription.",
      "enum": [
        "monthly",
        "annually"
      ]
    },
    "rbacEnabled": {
      "type": "boolean",
      "description": "This is the Role Based Access Control (RBAC) enabled flag for the subscription."
    },
    "platformFee": {
      "type": "number",
      "description": "This is the platform fee for the subscription."
    }
  },
  "required": [
    "id",
    "createdAt",
    "updatedAt",
    "type",
    "status",
    "credits",
    "concurrencyCounter",
    "concurrencyLimitIncluded",
    "concurrencyLimitPurchased"
  ]
}