{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/astranexo-com/json-schema/astranexo-com-certificate-verification-schema.json",
  "title": "CertificateVerification",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aster-openapi.yaml#/components/schemas/CertificateVerification",
  "type": "object",
  "properties": {
    "environment": {
      "$ref": "#/$defs/Environment"
    },
    "certificate": {
      "type": "object",
      "properties": {
        "valid": {
          "type": "boolean",
          "description": "El certificado abre con el PIN, está vigente y es de la organización."
        },
        "code": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "invalid_certificate_or_pin",
            "certificate_not_yet_valid",
            "certificate_mismatch",
            null
          ],
          "description": "Motivo cuando no es válido; un certificado vencido es `invalid_certificate_or_pin` con `expired: true`; uno que abre con el PIN pero cuya vigencia empieza después de hoy es `certificate_not_yet_valid` (ver `valid_from`)."
        },
        "message": {
          "type": "string"
        },
        "valid_from": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Inicio de vigencia (UTC); `null` si el archivo no abrió."
        },
        "expiry_date": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Vencimiento (UTC); `null` si el archivo no abrió."
        },
        "serial_number": {
          "type": [
            "string",
            "null"
          ]
        },
        "expired": {
          "type": "boolean"
        }
      }
    },
    "credentials": {
      "type": "object",
      "properties": {
        "checked": {
          "type": "boolean",
          "description": "`false` cuando el certificado no es válido: no se consulta al IDP."
        },
        "valid": {
          "type": "boolean"
        },
        "message": {
          "type": "string"
        }
      }
    }
  },
  "$defs": {
    "Environment": {
      "type": "string",
      "enum": [
        "staging",
        "production"
      ],
      "description": "Ambiente de Hacienda. Con claves de Aster lo decide la clave."
    }
  }
}