{
  "swagger": "2.0",
  "info": {
    "description": "",
    "version": "",
    "title": ""
  },
  "host": "",
  "basePath": "",
  "tags": [
    {
      "name": "Купонный сервер",
      "description": "Показать/скрыть методы"
    }
  ],
  "paths": {
    "/rest/coupon/coupons": {
      "get": {
        "tags": [
          "Купонный сервер"
        ],
        "summary": "Получить список купонов по номеру, без параметров пейджинации - максимально 500 записей",
        "operationId": "getCouponsUsingGET",
        "produces": [
          "*/*"
        ],
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "description": "Номер страницы данных, которые нужно отобразить",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Количество записей в каждой странице",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "number_starting",
            "in": "query",
            "description": "Искать купоны, номер которых начинающиеся с...",
            "required": false,
            "type": "string"
          },
          {
            "name": "mask",
            "in": "query",
            "description": "Маска купона",
            "required": false,
            "type": "string"
          },
          {
            "name": "campaignId",
            "in": "query",
            "description": "Идентификатор акции",
            "required": false,
            "type": "string"
          },
          {
            "name": "dateBeg",
            "in": "query",
            "description": "Начало действия купона",
            "required": false,
            "type": "string",
            "format": "date-time"
          },
          {
            "name": "dateEnd",
            "in": "query",
            "description": "Окончание действия купона",
            "required": false,
            "type": "string",
            "format": "date-time"
          },
          {
            "name": "state",
            "in": "query",
            "description": "Статус купона",
            "required": false,
            "type": "string",
            "enum": [
              "ACTIVE",
              "RESERVED",
              "PAID"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Coupon"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ROLE_ADMIN": []
          }
        ]
      },
      "post": {
        "tags": [
          "Купонный сервер"
        ],
        "summary": "Добавить купон на сервер",
        "description": "Добавление купона на сервер, купон после добавления активен и им можно пользоваться, state нельзя передавать",
        "operationId": "addCouponUsingPOST",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "*/*"
        ],
        "parameters": [
          {
            "in": "body",
            "name": "coupon",
            "description": "Добавляемый купон",
            "required": false,
            "schema": {
              "$ref": "#/definitions/Coupon"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ROLE_ADMIN": []
          }
        ]
      }
    },
    "/rest/coupon/coupons/bypage": {
      "get": {
        "tags": [
          "Купонный сервер"
        ],
        "summary": "Получить список купонов по номеру, без параметров пейджинации - максимально 500 записей",
        "operationId": "getCouponsByPageUsingGET",
        "produces": [
          "*/*"
        ],
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "description": "Номер страницы данных, которые нужно отобразить",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Количество записей в каждой странице",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "number_starting",
            "in": "query",
            "description": "Искать купоны, номер которых начинающиеся с...",
            "required": false,
            "type": "string"
          },
          {
            "name": "mask",
            "in": "query",
            "description": "Маска купона",
            "required": false,
            "type": "string"
          },
          {
            "name": "campaignId",
            "in": "query",
            "description": "Идентификатор акции",
            "required": false,
            "type": "string"
          },
          {
            "name": "dateBeg",
            "in": "query",
            "description": "Начало действия купона",
            "required": false,
            "type": "string",
            "format": "date-time"
          },
          {
            "name": "dateEnd",
            "in": "query",
            "description": "Окончание действия купона",
            "required": false,
            "type": "string",
            "format": "date-time"
          },
          {
            "name": "state",
            "in": "query",
            "description": "Статус купона",
            "required": false,
            "type": "string",
            "enum": [
              "ACTIVE",
              "RESERVED",
              "PAID"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/Page«Coupon»"
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ROLE_ADMIN": []
          }
        ]
      }
    },
    "/rest/coupon/coupons/getCountCouponsByFilter": {
      "get": {
        "tags": [
          "Купонный сервер"
        ],
        "summary": "Получить количество купонов с указанными фильтрами",
        "operationId": "getCountCouponsByFilterUsingGET",
        "produces": [
          "*/*"
        ],
        "parameters": [
          {
            "name": "number_starting",
            "in": "query",
            "description": "Искать купоны, номер которых начинающиеся с...",
            "required": false,
            "type": "string"
          },
          {
            "name": "mask",
            "in": "query",
            "description": "Маска купона",
            "required": false,
            "type": "string"
          },
          {
            "name": "campaignId",
            "in": "query",
            "description": "Идентификатор акции",
            "required": false,
            "type": "string"
          },
          {
            "name": "dateBeg",
            "in": "query",
            "description": "Начало действия купона",
            "required": false,
            "type": "string",
            "format": "date-time"
          },
          {
            "name": "dateEnd",
            "in": "query",
            "description": "Окончание действия купона",
            "required": false,
            "type": "string",
            "format": "date-time"
          },
          {
            "name": "state",
            "in": "query",
            "description": "Статус купона",
            "required": false,
            "type": "string",
            "enum": [
              "ACTIVE",
              "RESERVED",
              "PAID"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ROLE_ADMIN": []
          }
        ]
      }
    },
    "/rest/coupon/coupons/remove": {
      "get": {
        "tags": [
          "Купонный сервер"
        ],
        "summary": "Удалить купоны согласно заданным критериям",
        "operationId": "removeCouponsUsingGET",
        "produces": [
          "*/*"
        ],
        "parameters": [
          {
            "name": "number_starting",
            "in": "query",
            "description": "Искать купоны, номер которых начинающиеся с...",
            "required": false,
            "type": "string"
          },
          {
            "name": "mask",
            "in": "query",
            "description": "Маска купона",
            "required": false,
            "type": "string"
          },
          {
            "name": "campaignId",
            "in": "query",
            "description": "Идентификатор акции",
            "required": false,
            "type": "string"
          },
          {
            "name": "dateBeg",
            "in": "query",
            "description": "Начало действия купона",
            "required": false,
            "type": "string",
            "format": "date-time"
          },
          {
            "name": "dateEnd",
            "in": "query",
            "description": "Окончание действия купона",
            "required": false,
            "type": "string",
            "format": "date-time"
          },
          {
            "name": "state",
            "in": "query",
            "description": "Статус купона",
            "required": false,
            "type": "string",
            "enum": [
              "ACTIVE",
              "RESERVED",
              "PAID"
            ]
          },
          {
            "name": "force",
            "in": "query",
            "description": "Удалять все купоны",
            "required": false,
            "type": "boolean"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ROLE_ADMIN": []
          }
        ]
      }
    },
    "/rest/coupon/coupons/{number}": {
      "get": {
        "tags": [
          "Купонный сервер"
        ],
        "summary": "Получить купон по его номеру",
        "operationId": "getCouponUsingGET",
        "produces": [
          "*/*"
        ],
        "parameters": [
          {
            "name": "number",
            "in": "path",
            "description": "Номер купона",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/Coupon"
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ROLE_TERMINAL": []
          },
          {
            "ROLE_ADMIN": []
          }
        ]
      }
    },
    "/rest/coupon/coupons/{number}/activate": {
      "put": {
        "tags": [
          "Купонный сервер"
        ],
        "summary": "Активировать уже созданный купон",
        "operationId": "activateUsingPUT",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "*/*"
        ],
        "parameters": [
          {
            "name": "number",
            "in": "path",
            "description": "Номер купона",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ROLE_TERMINAL": []
          },
          {
            "ROLE_ADMIN": []
          }
        ]
      }
    },
    "/rest/coupon/coupons/{number}/deactivate": {
      "put": {
        "tags": [
          "Купонный сервер"
        ],
        "summary": "Деактивировать уже созданный купон",
        "operationId": "deactivateUsingPUT",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "*/*"
        ],
        "parameters": [
          {
            "name": "number",
            "in": "path",
            "description": "Номер купона",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ROLE_TERMINAL": []
          },
          {
            "ROLE_ADMIN": []
          }
        ]
      }
    },
    "/rest/coupon/masks": {
      "get": {
        "tags": [
          "Купонный сервер"
        ],
        "summary": "Получить список масок купонов, без параметров пейджинации - максимально 500 записей",
        "operationId": "getMasksUsingGET",
        "produces": [
          "*/*"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/CouponMask"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ROLE_ADMIN": []
          }
        ]
      }
    }
  },
  "definitions": {
    "Coupon": {
      "type": "object",
      "properties": {
        "campaignId": {
          "type": "string",
          "description": "Id дисконтной компании по которой был сгенерирован купон",
          "allowEmptyValue": false
        },
        "campaignName": {
          "type": "string",
          "description": "Название дисконтной компании по которой был сгенерирован купон",
          "allowEmptyValue": false
        },
        "creationDate": {
          "type": "string",
          "description": "Дата создания купона",
          "allowEmptyValue": false
        },
        "dateBeg": {
          "type": "string",
          "description": "Начало действия купона",
          "allowEmptyValue": false
        },
        "dateEnd": {
          "type": "string",
          "description": "Окончание действия купона",
          "allowEmptyValue": false
        },
        "dateUsed": {
          "type": "string",
          "description": "Дата использования купона",
          "allowEmptyValue": false
        },
        "mask": {
          "type": "string",
          "description": "Маска купона (значение используемое для связывания акции по выдаче купона, и акции на гашение)",
          "allowEmptyValue": false
        },
        "number": {
          "type": "string",
          "description": "Номер купона",
          "allowEmptyValue": false
        },
        "state": {
          "type": "string",
          "description": "Статус купона",
          "allowEmptyValue": false,
          "enum": [
            "ACTIVE",
            "RESERVED",
            "PAID"
          ]
        },
        "updateTime": {
          "type": "string",
          "format": "date-time",
          "description": "Для сохранения момента модификации записи",
          "allowEmptyValue": false
        }
      },
      "title": "Coupon",
      "description": "Информация о карте"
    },
    "CouponMask": {
      "type": "object",
      "properties": {
        "count": {
          "type": "integer",
          "format": "int64",
          "description": "Кол-во купонов с данной маской",
          "allowEmptyValue": false
        },
        "mask": {
          "type": "string",
          "description": "Маска",
          "allowEmptyValue": false
        }
      },
      "title": "CouponMask",
      "description": "Информация о маске купона"
    },
    "Page«Coupon»": {
      "type": "object",
      "properties": {
        "content": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Coupon"
          }
        },
        "first": {
          "type": "boolean"
        },
        "last": {
          "type": "boolean"
        },
        "number": {
          "type": "integer",
          "format": "int32"
        },
        "numberOfElements": {
          "type": "integer",
          "format": "int32"
        },
        "size": {
          "type": "integer",
          "format": "int32"
        },
        "sort": {
          "$ref": "#/definitions/Sort"
        },
        "totalElements": {
          "type": "integer",
          "format": "int64"
        },
        "totalPages": {
          "type": "integer",
          "format": "int32"
        }
      },
      "title": "Page«Coupon»"
    },
    "Sort": {
      "type": "object",
      "title": "Sort"
    }
  }
}