{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://axis.efeonce.org/contracts/candidate/social-native-post-intent.v0.1.schema.json",
  "title": "Efeonce Insights — post nativo de redes, intent de composición (efeonce.social-native-post 0.1.0, candidate)",
  "description": "Intent del post nativo: la pieza en su proporción publicada, sus marcas de formato, la fila de acciones con glifos Trazo, el texto con acentos y los medidores de video. Refleja AxisSocialNativePostIntent de @efeoncepro/axis-ui-contracts. Cifras ya formateadas por el productor; una acción que la red no entrega se omite (nunca 0). pnpm social:post:resolve toma los valores de efeonceInsights.socialNativePost. Las reglas que cruzan campos (video sólo en reel o story, postId único, acciones sin signo) las verifica el contrato.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "surface",
    "posts"
  ],
  "properties": {
    "contract": {
      "const": "efeonce.social-native-post"
    },
    "version": {
      "enum": [
        "0.1.0"
      ]
    },
    "surface": {
      "enum": [
        "a4",
        "deck",
        "web"
      ]
    },
    "locale": {
      "enum": [
        "es",
        "en"
      ],
      "description": "Idioma de la lectura de las acciones y del alt por defecto; por defecto es."
    },
    "row": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "widthPx",
        "gapPx",
        "maxHeightPx"
      ],
      "properties": {
        "widthPx": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "gapPx": {
          "type": "number",
          "minimum": 0
        },
        "maxHeightPx": {
          "type": "number",
          "exclusiveMinimum": 0
        }
      },
      "description": "Fila de altura igual."
    },
    "posts": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "postId",
          "platform",
          "platformName",
          "format",
          "publishedOn"
        ],
        "properties": {
          "postId": {
            "type": "string",
            "minLength": 1
          },
          "accountId": {
            "type": "string",
            "minLength": 1
          },
          "platform": {
            "type": "string",
            "minLength": 1
          },
          "platformName": {
            "type": "string",
            "minLength": 1
          },
          "format": {
            "enum": [
              "reel",
              "story",
              "carousel",
              "post"
            ]
          },
          "publishedOn": {
            "type": "string",
            "minLength": 1,
            "description": "Fecha ya redactada («19 oct»)."
          },
          "rank": {
            "type": "string",
            "minLength": 1
          },
          "media": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "ref",
                  "width",
                  "height"
                ],
                "properties": {
                  "ref": {
                    "type": "string",
                    "minLength": 1
                  },
                  "width": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "height": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "alt": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              }
            ]
          },
          "figure": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "display",
              "label"
            ],
            "properties": {
              "display": {
                "type": "string",
                "minLength": 1
              },
              "label": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          "actions": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "reactions": {
                "type": "string",
                "minLength": 1,
                "pattern": "^[^+\\-−]"
              },
              "comments": {
                "type": "string",
                "minLength": 1,
                "pattern": "^[^+\\-−]"
              },
              "shares": {
                "type": "string",
                "minLength": 1,
                "pattern": "^[^+\\-−]"
              },
              "saves": {
                "type": "string",
                "minLength": 1,
                "pattern": "^[^+\\-−]"
              }
            }
          },
          "caption": {
            "type": "string",
            "minLength": 1
          },
          "video": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "durationSec": {
                "type": "number",
                "exclusiveMinimum": 0
              },
              "retention": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "skipRate": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            }
          },
          "link": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string",
                "pattern": "^https://"
              }
            }
          }
        }
      }
    }
  }
}
