{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://uqp.dev/spec/schemas/pricing-model.json",
  "title": "PricingModel",
  "type": "object",
  "properties": {
    "pack_id": {
      "$ref": "common.json#/$defs/packId"
    },
    "pack_version": {
      "$ref": "common.json#/$defs/packVersion"
    },
    "id": {
      "type": "string",
      "minLength": 1
    },
    "artist_review_mode": {
      "$ref": "common.json#/$defs/reviewMode"
    },
    "factors": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "enabled": {
            "type": "boolean"
          },
          "weight": {
            "type": "number"
          },
          "value": {},
          "mode": {
            "type": "string",
            "minLength": 1
          },
          "provenance": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "id",
          "enabled"
        ],
        "additionalProperties": false
      }
    },
    "rates": {
      "type": "object",
      "additionalProperties": true
    },
    "minimums": {
      "type": "object",
      "additionalProperties": true
    },
    "rounding": {
      "type": "object",
      "properties": {
        "increment": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "mode": {
          "enum": [
            "nearest",
            "up",
            "down"
          ]
        }
      },
      "required": [
        "increment",
        "mode"
      ],
      "additionalProperties": false
    },
    "deposit_policy": {
      "type": "object",
      "properties": {
        "mode": {
          "type": "string",
          "minLength": 1
        },
        "amount": {
          "type": "number",
          "minimum": 0
        },
        "percentage": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "basis": {
          "type": "string",
          "minLength": 1
        },
        "rounding_increment": {
          "type": [
            "number",
            "null"
          ],
          "exclusiveMinimum": 0
        },
        "policies": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "required": [
        "mode"
      ],
      "additionalProperties": false
    },
    "expiry_days": {
      "$ref": "common.json#/$defs/expiryDays"
    },
    "provenance": {
      "type": "string",
      "minLength": 1
    },
    "keyword_match": {
      "enum": [
        "substring",
        "whole_word"
      ]
    }
  },
  "required": [
    "pack_id",
    "pack_version",
    "factors",
    "rates",
    "minimums",
    "rounding",
    "deposit_policy",
    "expiry_days"
  ],
  "additionalProperties": false
}
