{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/commsharbor/json-schema/commsharbor-registro-de-assinatura-schema.json",
  "title": "RegistroDeAssinatura",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/commsharbor-credito-api-openapi.yml#/components/schemas/RegistroDeAssinatura",
  "type": "object",
  "properties": {
    "ajuste_renovacao": {
      "type": [
        "string",
        "null"
      ],
      "description": "When reading a discounted first invoice, pendente or atencao indicate that the next-invoice price needs adjustment. The paid plan has already been delivered. Missing or null when no adjustment is pending."
    },
    "recurso": {
      "type": "string",
      "description": "Product resource: at most 256 characters, without controls. Empty means an account subscription."
    },
    "id": {
      "type": "string",
      "description": "Local subscription ID: 32 lowercase hexadecimal characters. Use it for reads and cancellation."
    },
    "oferta_id": {
      "type": "string",
      "description": "Accepted offer ID."
    },
    "oferta": {
      "allOf": [
        {
          "$ref": "#/$defs/OfertaDeAssinatura"
        }
      ],
      "description": "Offer saved at acceptance. A catalog change does not replace this record."
    },
    "estado": {
      "type": "string",
      "description": "criando, inconclusiva, checkout, aguardando_pagamento, ativa, cancelando, cancelada, falhou or expirada."
    },
    "simulado": {
      "type": "boolean",
      "description": "Server-recorded environment: true for sandbox, false for production."
    },
    "pagamento_em": {
      "type": [
        "string",
        "null"
      ],
      "description": "Asaas hosted HTTPS invoice link to complete card payment when in checkout or aguardando_pagamento; null otherwise."
    },
    "criado_em": {
      "type": "string",
      "description": "Subscription creation time in UTC."
    },
    "atualizado_em": {
      "type": "string",
      "description": "Last change time in UTC."
    },
    "cancelamento_em": {
      "type": [
        "string",
        "null"
      ],
      "description": "Cancellation request time in UTC, or null."
    },
    "cancelado_em": {
      "type": [
        "string",
        "null"
      ],
      "description": "Confirmed cancellation time in UTC, or null."
    },
    "pago_ate": {
      "type": [
        "string",
        "null"
      ],
      "description": "On reads and cancellation, UTC end of the last period with a confirmed, non-refunded invoice; null without a paid invoice. It is not the next charge date or the free trial."
    }
  },
  "required": [
    "recurso",
    "id",
    "oferta_id",
    "oferta",
    "estado",
    "simulado",
    "pagamento_em",
    "criado_em",
    "atualizado_em",
    "cancelamento_em",
    "cancelado_em",
    "pago_ate"
  ],
  "$defs": {
    "BeneficioDeAssinatura": {
      "type": "object",
      "properties": {
        "sku": {
          "type": "string",
          "description": "Product capability: a lowercase letter followed by letters, digits or underscores; at most 64 characters."
        },
        "quantidade": {
          "type": "integer",
          "description": "1 to 1,000,000 units for each paid period."
        }
      },
      "required": [
        "sku",
        "quantidade"
      ]
    },
    "OfertaDeAssinatura": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Offer ID: 2 to 64 characters. Start with a lowercase letter. Use lowercase letters, digits, hyphens or underscores."
        },
        "produto": {
          "type": "string",
          "description": "Product ID, with the same format as the offer ID."
        },
        "versao": {
          "type": "integer",
          "description": "Offer version: 1 to 1,000,000."
        },
        "preco_centavos": {
          "type": "integer",
          "description": "Price per cycle in cents: 500 to 1,000,000."
        },
        "moeda": {
          "type": "string",
          "description": "Fixed currency: BRL."
        },
        "ciclo": {
          "type": "string",
          "description": "MONTHLY for a monthly offer; WEEKLY for a weekly offer."
        },
        "renovacao_automatica": {
          "type": "boolean",
          "description": "true: billing repeats each cycle until cancellation."
        },
        "compromisso_meses": {
          "type": "integer",
          "description": "Present only for MONTHLY: one calendar month."
        },
        "compromisso_semanas": {
          "type": "integer",
          "description": "Present only for WEEKLY: one seven-day period."
        },
        "cancelamento": {
          "type": "string",
          "description": "stop_future_charges: stop new charges."
        },
        "acesso_pago": {
          "type": "string",
          "description": "until_paid_period_end: keep access until the paid period ends."
        },
        "teste_dias": {
          "type": "integer",
          "description": "Configured trial length: 0 to 30 days. Reading the catalog grants no trial or benefit."
        },
        "primeira_cobranca": {
          "type": "string",
          "description": "First charge date in Brasilia (YYYY-MM-DD), selected by the server to preserve the current period. Included in the offer hash and acceptance."
        },
        "desconto_primeira_cobranca_centavos": {
          "type": "integer",
          "description": "Deduction in cents for the first invoice only, at most the cycle price. Requires primeira_cobranca and is included in the accepted offer hash. Following cycles keep preco_centavos."
        },
        "conversao_teste": {
          "type": "string",
          "description": "opt_in: a trial does not create or renew a subscription."
        },
        "beneficios": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BeneficioDeAssinatura"
          },
          "description": "1 to 8 distinct capabilities for each paid period."
        },
        "hash": {
          "type": "string",
          "description": "SHA-256 of the complete offer: 64 lowercase hexadecimal characters."
        }
      },
      "required": [
        "id",
        "produto",
        "versao",
        "preco_centavos",
        "moeda",
        "ciclo",
        "renovacao_automatica",
        "compromisso_meses",
        "compromisso_semanas",
        "cancelamento",
        "acesso_pago",
        "teste_dias",
        "conversao_teste",
        "beneficios",
        "hash"
      ]
    }
  }
}