{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/alert-camp/json-schema/alert-camp-subscription-response-schema.json",
  "title": "SubscriptionResponse",
  "description": "Schema for subscription response.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/alert-camp-subscriptions-api-openapi.yml#/components/schemas/SubscriptionResponse",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "user_id": {
      "type": "string",
      "title": "User Id"
    },
    "status": {
      "$ref": "#/$defs/SubscriptionStatusEnum"
    },
    "plan": {
      "anyOf": [
        {
          "$ref": "#/$defs/SubscriptionPlanEnum"
        },
        {
          "type": "null"
        }
      ]
    },
    "tier": {
      "allOf": [
        {
          "$ref": "#/$defs/SubscriptionTierEnum"
        }
      ],
      "default": "essai"
    },
    "pending_tier": {
      "anyOf": [
        {
          "$ref": "#/$defs/SubscriptionTierEnum"
        },
        {
          "type": "null"
        }
      ]
    },
    "trial_start": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Trial Start"
    },
    "trial_end": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Trial End"
    },
    "current_period_start": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Current Period Start"
    },
    "current_period_end": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Current Period End"
    },
    "canceled_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Canceled At"
    },
    "cancel_at_period_end": {
      "type": "boolean",
      "title": "Cancel At Period End"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At"
    },
    "is_active": {
      "type": "boolean",
      "title": "Is Active"
    },
    "is_trial": {
      "type": "boolean",
      "title": "Is Trial"
    },
    "trial_days_remaining": {
      "type": "integer",
      "title": "Trial Days Remaining"
    },
    "days_until_renewal": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Days Until Renewal"
    }
  },
  "type": "object",
  "required": [
    "id",
    "user_id",
    "status",
    "plan",
    "trial_start",
    "trial_end",
    "current_period_start",
    "current_period_end",
    "canceled_at",
    "cancel_at_period_end",
    "created_at",
    "updated_at",
    "is_active",
    "is_trial",
    "trial_days_remaining",
    "days_until_renewal"
  ],
  "$defs": {
    "SubscriptionPlanEnum": {
      "type": "string",
      "enum": [
        "monthly"
      ],
      "const": "monthly",
      "title": "SubscriptionPlanEnum",
      "description": "Available subscription plans."
    },
    "SubscriptionStatusEnum": {
      "type": "string",
      "enum": [
        "trial",
        "active",
        "past_due",
        "canceled",
        "expired"
      ],
      "title": "SubscriptionStatusEnum",
      "description": "Subscription status states."
    },
    "SubscriptionTierEnum": {
      "type": "string",
      "enum": [
        "essai",
        "regular",
        "pro"
      ],
      "title": "SubscriptionTierEnum",
      "description": "Subscription tier levels."
    }
  }
}