{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "individualRateSet.schema.json",
    "title": "individualRateSet",
    "type": "object",
    "description": "Набор индивидуальных ставок",
    "properties": {
        "createdByRole": {
            "$ref": "common/_common.schema.json#/userRole",
            "description": "Роль пользователя, создавшего запрос"
        },
        "partner": {
            "$ref": "partner.schema.json",
            "description": "Партнер создавший запрос"
        },
        "customer": {
            "$ref": "customer.schema.json",
            "description": "Клиент создавший запрос"
        },
        "scope": {
            "enum": [
              "ONE_ORDER",
              "ALL_ORDERS"
            ],
           "description": "Действует для: ONE_ORDER - одна заявка, ALL_ORDERS - все заявки"
        },
        "notValidBefore": {
            "type": "string",
            "format": "date",
            "description": "Дата начала"
        },
        "notValidAfter": {
            "type": "string",
            "format": "date",
            "description": "Дата окончания"
        },
        "agent": {
            "$ref": "agent.schema.json"
        },
        "monthlyAmount": {
            "type": "number",
            "minimum": 0.01,
            "multipleOf": 0.01,
            "description": "Cовокупный объем платежей в месяц"
        },
        "monthlyAmountCurrency": {
            "description": "Валюта совокупного объема платежей в месяц",
            "$ref": "common/_common.schema.json#/currency"
        },
        "averageMonthlyCountPayment": {
            "type": "number",
            "minimum": 1,
            "maximum": 1000,
            "multipleOf": 1,
            "description": "Среднее количество платежей в месяц"
        },
        "countries": {
            "type": "array",
            "item": {
              "$ref": "common/_common.schema.json#/country",
              "description": "Страны получателей платежей"
            }
        },
        "currencies": {
            "type": "array",
            "item": {
              "$ref": "common/_common.schema.json#/currency",
              "description": "Валюты конечных платежей"
            }
        },
        "comment": {
            "type": "string",
            "description": "Комментарий"
        },
        "sentAt": {
            "type": "string",
            "format": "date-time",
            "description": "Дата и время отправки запроса пользователем, создавшим запрос"
        },
        "reviewedByPartner": {
            "type": "boolean",
            "description": "Партнер ознакомлен с запросом от клиента"
        },
        "status": {
            "enum": [
                "DRAFT",
                "CONTRACTOR_VERIFICATION",
                "AGENT_APPROVAL",
                "APPROVED",
                "REJECTED",
                "ACTIVE",
                "EXPIRED",
                "REDEEMED",
                "CANCELLED"
            ],
            "description": "Статус. DRAFT - черновик, CONTRACTOR_VERIFICATION - проверка исполнителем, AGENT_APPROVAL - согласование агентом,  APPROVED - Согласован, REJECTED - Отклонён, ACTIVE - Активен, EXPIRED - Срок действия истек, REDEEMED - Использован в заявке, CANCELLED - Аннулирован"
        },
        "changedAt": {
            "description": "Дата и время последнего изменения набора",
            "type": "string",
            "format": "datetime"
        },
        "notApprovalComment": {
            "type": "string",
            "description": "Комментарий при отклонении запроса"
        },
        "isChangedByAgent": {
            "type": "boolean",
            "description": "Агент внес изменения в строки заявки"
        },
        "rates": {
            "type": "array",
            "item": {
                "type": "object",
                "properties": {
                    "currencyCustomer": {
                        "description": "Валюта отправителя",
                        "$ref": "common/_common.schema.json#/currency"
                    },
                    "currency": {
                        "description": "Валюта получателя",
                        "$ref": "common/_common.schema.json#/currency"
                    },
                    "country": {
                        "description": "Страна банка получателя",
                        "$ref": "common/_common.schema.json#/country"
                    },
                    "minAmount": {
                        "type": "number",
                        "minimum": 0.01,
                        "maximum": 99999999999.99,
                        "multipleOf": 0.01,
                        "description": "Нижняя граница диапазона"
                    },
                    "maxAmount": {
                        "type": "number",
                        "minimum": 0.01,
                        "maximum": 99999999999.99,
                        "multipleOf": 0.01,
                        "description": "Верхняя граница диапазона"
                    },
                    "percent": {
                        "type": "number",
                        "minimum": 0.0,
                        "multipleOf": 0.0001,
                        "maximum": 99999999999.9999,
                        "description": "Размер ставки, указывается в %"
                    },
                    "minimumRateThreshold": {
                        "type": "number",
                        "minimum": 0.00,
                        "multipleOf": 0.01,
                        "maximum": 99999999999.9999,
                        "description": "Не менее указанной суммы"
                    }
                }
            }
        }
    }
}