{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "cart",
  "description": "Sepet. Satır adedi değişince `change`; `total` botun otoriter toplamıdır.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "type",
    "version",
    "lines",
    "total"
  ],
  "properties": {
    "type": {
      "type": "string",
      "enum": [
        "cart"
      ]
    },
    "version": {
      "type": "integer",
      "enum": [
        1
      ]
    },
    "tone": {
      "type": "string",
      "enum": [
        "neutral",
        "success",
        "warning",
        "danger",
        "brand"
      ]
    },
    "brand_color": {
      "type": "string",
      "enum": [
        "mavi",
        "turuncu",
        "mor",
        "pembe",
        "altin",
        "yesil",
        "turkuaz"
      ]
    },
    "lines": {
      "type": "array",
      "minItems": 1,
      "maxItems": 50,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,31}$",
            "description": "form alanı/grup kimliği; `values` anahtarı"
          },
          "name": {
            "type": "string",
            "maxLength": 80,
            "minLength": 1
          },
          "unit_price": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000
              },
              "currency": {
                "type": "string",
                "enum": [
                  "TRY",
                  "INK",
                  "USD",
                  "EUR"
                ]
              }
            },
            "required": [
              "amount",
              "currency"
            ],
            "description": "tutar; biçimlendirmeyi (₺, ondalık ayracı) istemci yapar"
          },
          "quantity": {
            "type": "integer",
            "minimum": 0,
            "maximum": 99
          },
          "max_quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 99
          }
        },
        "required": [
          "id",
          "name",
          "unit_price",
          "quantity"
        ]
      }
    },
    "total": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "amount": {
          "type": "number",
          "minimum": 0,
          "maximum": 1000000000
        },
        "currency": {
          "type": "string",
          "enum": [
            "TRY",
            "INK",
            "USD",
            "EUR"
          ]
        }
      },
      "required": [
        "amount",
        "currency"
      ],
      "description": "tutar; biçimlendirmeyi (₺, ondalık ayracı) istemci yapar"
    },
    "actions": {
      "type": "array",
      "minItems": 1,
      "maxItems": 3,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "action_id": {
            "type": "string",
            "pattern": "^[a-z0-9_-]{1,64}$",
            "description": "düğme eylem kimliği; `values.action_id` olarak geri gelir"
          },
          "label": {
            "type": "string",
            "maxLength": 40,
            "minLength": 1
          },
          "style": {
            "type": "string",
            "enum": [
              "primary",
              "secondary",
              "danger"
            ]
          },
          "disabled": {
            "type": "boolean"
          }
        },
        "required": [
          "action_id",
          "label"
        ],
        "description": "basılınca `inki_component_action{action:\"submit\", values:{action_id}}`"
      }
    }
  },
  "x-inki-eylem": [
    {
      "action": "change",
      "values": {
        "lines[].id": "yeni adet (0 = çıkar)"
      }
    },
    {
      "action": "submit",
      "values": {
        "action_id": "actions[].action_id"
      }
    }
  ]
}
