{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/gerencianet/main/json-schema/efi-pix-cob-schema.json",
  "title": "Pix Immediate Charge (Cob)",
  "description": "Banco Central Pix immediate charge as represented by the Efí Pay /v2/cob endpoints.",
  "type": "object",
  "required": ["txid", "valor", "chave"],
  "properties": {
    "txid": { "type": "string", "minLength": 26, "maxLength": 35, "pattern": "^[a-zA-Z0-9]+$" },
    "status": { "type": "string", "enum": ["ATIVA", "CONCLUIDA", "REMOVIDA_PELO_USUARIO_RECEBEDOR", "REMOVIDA_PELO_PSP"] },
    "valor": {
      "type": "object",
      "required": ["original"],
      "properties": {
        "original": { "type": "string", "pattern": "^[0-9]+\\.[0-9]{2}$" },
        "modalidadeAlteracao": { "type": "integer", "enum": [0, 1] }
      }
    },
    "chave": { "type": "string", "description": "Receiver Pix key (EVP, CPF, CNPJ, email, or phone)" },
    "calendario": {
      "type": "object",
      "properties": {
        "criacao": { "type": "string", "format": "date-time" },
        "expiracao": { "type": "integer", "description": "Seconds from creation to expiration", "default": 3600 }
      }
    },
    "devedor": {
      "type": "object",
      "properties": {
        "cpf": { "type": "string", "pattern": "^[0-9]{11}$" },
        "cnpj": { "type": "string", "pattern": "^[0-9]{14}$" },
        "nome": { "type": "string" }
      }
    },
    "loc": {
      "type": "object",
      "properties": {
        "id": { "type": "integer" },
        "location": { "type": "string", "format": "uri" },
        "tipoCob": { "type": "string", "enum": ["cob", "cobv"] }
      }
    },
    "solicitacaoPagador": { "type": "string", "maxLength": 140 },
    "infoAdicionais": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["nome", "valor"],
        "properties": {
          "nome": { "type": "string", "maxLength": 50 },
          "valor": { "type": "string", "maxLength": 200 }
        }
      }
    }
  }
}
