{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://brimatt16219.github.io/l3lint/schemas/rates.schema.json",
  "title": "l3lint rate table",
  "description": "A user-maintained interchange rate table for cost estimates. l3lint ships no rates. Percent values are in percent (1.75 means 1.75%).",
  "type": "object",
  "additionalProperties": false,
  "required": ["name", "effective", "currency", "categories"],
  "properties": {
    "name": { "type": "string", "minLength": 1 },
    "effective": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" },
    "currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
    "programFees": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["brand", "when", "percent"],
        "properties": {
          "brand": { "$ref": "#/$defs/brand" },
          "when": { "enum": ["enhancedDataSent", "always"] },
          "percent": { "type": "number", "minimum": 0 },
          "fixed": { "type": "number", "minimum": 0 }
        }
      }
    },
    "categories": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["brand", "tier", "percent"],
        "properties": {
          "brand": { "$ref": "#/$defs/brand" },
          "products": { "type": "array", "items": { "enum": ["consumer", "business", "corporate", "purchasing", "fleet", "commercialPrepaid"] }, "minItems": 1 },
          "tier": { "enum": ["product3", "product2", "cardNotPresent", "cardPresent", "largeTicket", "dataRate3", "dataRate2", "dataRate1", "standard"] },
          "percent": { "type": "number", "minimum": 0 },
          "fixed": { "type": "number", "minimum": 0 },
          "name": { "type": "string" }
        }
      }
    }
  },
  "$defs": {
    "brand": { "enum": ["visa", "mastercard", "amex", "discover"] }
  }
}
