{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "coupon",
  "description": "Kupon. Kodu kopyalama istemcide yerel.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "type",
    "version",
    "code",
    "discount"
  ],
  "properties": {
    "type": {
      "type": "string",
      "enum": [
        "coupon"
      ]
    },
    "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"
      ]
    },
    "code": {
      "type": "string",
      "maxLength": 32,
      "minLength": 1
    },
    "discount": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "percent",
            "amount"
          ]
        },
        "value": {
          "type": "number",
          "minimum": 0,
          "maximum": 1000000000
        },
        "currency": {
          "type": "string",
          "enum": [
            "TRY",
            "INK",
            "USD",
            "EUR"
          ]
        }
      },
      "required": [
        "kind",
        "value"
      ]
    },
    "title": {
      "type": "string",
      "maxLength": 80
    },
    "min_spend": {
      "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"
    },
    "valid_until": {
      "type": "string",
      "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$",
      "description": "YYYY-MM-DD"
    }
  }
}
