{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dabradata-com/json-schema/dabradata-com-nfse-emissor-saida-schema.json",
  "title": "EmissorSaida",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dabradata-com-openapi.yaml#/components/schemas/NfseEmissorSaida",
  "properties": {
    "id": {
      "type": "integer",
      "title": "Id"
    },
    "cnpj": {
      "type": "string",
      "title": "Cnpj"
    },
    "razao": {
      "type": "string",
      "title": "Razao"
    },
    "c_mun": {
      "type": "string",
      "title": "C Mun"
    },
    "im": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Im"
    },
    "op_simp_nac": {
      "type": "integer",
      "title": "Op Simp Nac"
    },
    "reg_ap_trib_sn": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reg Ap Trib Sn"
    },
    "reg_esp_trib": {
      "type": "integer",
      "title": "Reg Esp Trib"
    },
    "p_tot_trib_sn": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "P Tot Trib Sn"
    },
    "reg_ap_ibscbs_sn": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reg Ap Ibscbs Sn"
    },
    "c_atv_sn": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "C Atv Sn"
    },
    "c_trib_nac": {
      "type": "string",
      "title": "C Trib Nac"
    },
    "c_nbs": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "C Nbs"
    },
    "com_ext_padrao": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Com Ext Padrao"
    },
    "serie": {
      "type": "integer",
      "title": "Serie"
    },
    "proximo_numero": {
      "type": "integer",
      "title": "Proximo Numero"
    },
    "email": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Email"
    },
    "fone": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Fone"
    },
    "ambiente": {
      "type": "integer",
      "title": "Ambiente",
      "description": "1 produção, 2 produção restrita, 3 sandbox (simulador, sem certificado)"
    },
    "ativo": {
      "type": "boolean",
      "title": "Ativo"
    },
    "certificado": {
      "anyOf": [
        {
          "$ref": "#/$defs/NfseCertificadoSaida"
        },
        {
          "type": "null"
        }
      ],
      "description": "o A1 gravado (só leitura do titular e da validade); null antes do upload e sempre no sandbox"
    },
    "pausa": {
      "anyOf": [
        {
          "$ref": "#/$defs/NfsePausa"
        },
        {
          "type": "null"
        }
      ],
      "description": "breaker: envio à Sefin parado até `ate` (ou até o operador liberar)"
    }
  },
  "type": "object",
  "required": [
    "id",
    "cnpj",
    "razao",
    "c_mun",
    "im",
    "op_simp_nac",
    "reg_ap_trib_sn",
    "reg_esp_trib",
    "p_tot_trib_sn",
    "reg_ap_ibscbs_sn",
    "c_atv_sn",
    "c_trib_nac",
    "c_nbs",
    "com_ext_padrao",
    "serie",
    "proximo_numero",
    "email",
    "fone",
    "ambiente",
    "ativo",
    "certificado",
    "pausa"
  ],
  "$defs": {
    "NfseCertificadoSaida": {
      "properties": {
        "cnpj": {
          "type": "string",
          "title": "Cnpj"
        },
        "valido_ate": {
          "type": "string",
          "format": "date-time",
          "title": "Valido Ate",
          "description": "fim da validade do A1; o evento `nfse.certificado_vencendo` (webhooks da Dabra) avisa 30, 15 e 7 dias antes"
        }
      },
      "type": "object",
      "required": [
        "cnpj",
        "valido_ate"
      ],
      "title": "CertificadoSaida"
    },
    "NfsePausa": {
      "properties": {
        "ate": {
          "type": "string",
          "format": "date-time",
          "title": "Ate"
        },
        "motivo": {
          "type": "string",
          "title": "Motivo"
        }
      },
      "type": "object",
      "required": [
        "ate",
        "motivo"
      ],
      "title": "Pausa"
    }
  }
}