// Code generated by go-swagger; DO NOT EDIT.

package restapi

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"encoding/json"
)

var (
	// SwaggerJSON embedded version of the swagger document used at generation time
	SwaggerJSON json.RawMessage
	// FlatSwaggerJSON embedded flattened version of the swagger document used at generation time
	FlatSwaggerJSON json.RawMessage
)

func init() {
	SwaggerJSON = json.RawMessage([]byte(`{
  "schemes": [
    "http",
    "https"
  ],
  "swagger": "2.0",
  "info": {
    "description": "An API which supports creation, deletion, listing etc of Credit Manager",
    "title": "Credit Manager Management API",
    "contact": {
      "email": "diego@cyclops-labs.io"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "1.0.0"
  },
  "host": "localhost:8000",
  "basePath": "/api/v1.0",
  "paths": {
    "/account/available/{id}": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "creditManagement"
        ],
        "summary": "Credit status of the account with the provided id",
        "operationId": "getCredit",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be checked",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Credit status of the account with the provided id",
            "schema": {
              "$ref": "#/definitions/CreditStatus"
            }
          },
          "404": {
            "description": "The account with the provided id doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/account/create/{id}": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "admin"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "accountManagement"
        ],
        "summary": "Creates a new account in the system",
        "operationId": "createAccount",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be created",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Account created, provided information of the new item created",
            "schema": {
              "$ref": "#/definitions/AccountStatus"
            }
          },
          "409": {
            "description": "The account with the id provided already exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/account/disable/{id}": {
      "post": {
        "security": [
          {
            "Keycloak": [
              "admin"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "accountManagement"
        ],
        "summary": "Disables the account with the id provided in the system",
        "operationId": "disableAccount",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be disabled",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Status information of the account with provided id in the system after the operation succeded",
            "schema": {
              "$ref": "#/definitions/AccountStatus"
            }
          },
          "404": {
            "description": "The account with the id provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/account/enable/{id}": {
      "post": {
        "security": [
          {
            "Keycloak": [
              "admin"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "accountManagement"
        ],
        "summary": "Enables the account with the id provided in the system",
        "operationId": "enableAccount",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be enabled",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Status information of the account with provided id in the system after the operation succeded",
            "schema": {
              "$ref": "#/definitions/AccountStatus"
            }
          },
          "404": {
            "description": "The account with the id provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/account/list": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "accountManagement"
        ],
        "summary": "List of the accounts in the system",
        "operationId": "listAccounts",
        "responses": {
          "200": {
            "description": "List of accounts in the system",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/AccountStatus"
              }
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/account/status/{id}": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "accountManagement"
        ],
        "summary": "Basic status of the account with the id provided in the system",
        "operationId": "getAccountStatus",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be checked",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Status information of the account with provided id in the system",
            "schema": {
              "$ref": "#/definitions/AccountStatus"
            }
          },
          "404": {
            "description": "The account with the id provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/history/{id}": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "creditManagement"
        ],
        "summary": "Credit history of the customer with id",
        "operationId": "getHistory",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to get the history",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "type": "boolean",
            "description": "Boolean variable to control if the system consumptions have to be listed or not",
            "name": "filterSystem",
            "in": "query"
          },
          {
            "enum": [
              "credit",
              "cash"
            ],
            "type": "string",
            "description": "Medium (cash/credit) to be used as filter",
            "name": "medium",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Credit status history of the account with the provided id",
            "schema": {
              "$ref": "#/definitions/CreditHistory"
            }
          },
          "404": {
            "description": "The endpoint provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/status": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "statusManagement"
        ],
        "summary": "Basic status of the system",
        "operationId": "showStatus",
        "responses": {
          "200": {
            "description": "Status information of the system",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        }
      }
    },
    "/status/{id}": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "statusManagement"
        ],
        "summary": "Basic status of the system",
        "operationId": "getStatus",
        "parameters": [
          {
            "enum": [
              "kafka-receiver",
              "kafka-sender",
              "status",
              "trigger",
              "account",
              "credit"
            ],
            "type": "string",
            "description": "Id of the endpoint to be checked",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Status information of the system",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          },
          "404": {
            "description": "The endpoint provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/trigger/sample": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "triggerManagement"
        ],
        "summary": "Sample task trigger",
        "operationId": "execSample",
        "responses": {
          "200": {
            "description": "Sample task executed successfully"
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/{medium}/available/decrease/{id}": {
      "post": {
        "security": [
          {
            "Keycloak": [
              "admin"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "creditManagement"
        ],
        "summary": "Insert a new reseller in the system.",
        "operationId": "decreaseCredit",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be checked",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "type": "number",
            "format": "double",
            "description": "Amount to be decreased",
            "name": "amount",
            "in": "query",
            "required": true
          },
          {
            "enum": [
              "credit",
              "cash"
            ],
            "type": "string",
            "description": "Medium (cash/credit) to be used in the accounting",
            "name": "medium",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Credit status of the account with the provided id",
            "schema": {
              "$ref": "#/definitions/CreditStatus"
            }
          },
          "404": {
            "description": "The account with the id provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/{medium}/available/increase/{id}": {
      "post": {
        "security": [
          {
            "Keycloak": [
              "admin"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "creditManagement"
        ],
        "summary": "Insert a new reseller in the system.",
        "operationId": "increaseCredit",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be checked",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "type": "number",
            "format": "double",
            "description": "Amount to be inccreased",
            "name": "amount",
            "in": "query",
            "required": true
          },
          {
            "enum": [
              "credit",
              "cash"
            ],
            "type": "string",
            "description": "Medium (cash/credit) to be used in the accounting",
            "name": "medium",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Credit status of the account with the provided id",
            "schema": {
              "$ref": "#/definitions/CreditStatus"
            }
          },
          "404": {
            "description": "The account with the id provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/{medium}/consume/{id}": {
      "post": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "creditManagement"
        ],
        "summary": "Adds a consumption to the system",
        "operationId": "addConsumption",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be checked",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "type": "number",
            "format": "double",
            "description": "Amount to be decreased",
            "name": "amount",
            "in": "query",
            "required": true
          },
          {
            "enum": [
              "credit",
              "cash"
            ],
            "type": "string",
            "description": "Medium (cash/credit) to be used in the accounting",
            "name": "medium",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Credit status of the account with the provided id",
            "schema": {
              "$ref": "#/definitions/CreditStatus"
            }
          },
          "404": {
            "description": "The account with the id provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "AccountStatus": {
      "type": "object",
      "required": [
        "Enabled"
      ],
      "properties": {
        "AccountID": {
          "type": "string",
          "x-go-custom-tag": "gorm:\"primary_key\""
        },
        "CreatedAt": {
          "type": "string",
          "format": "datetime",
          "x-go-custom-tag": "gorm:\"type:timestamptz\""
        },
        "Enabled": {
          "type": "boolean",
          "default": true,
          "x-go-custom-tag": "gorm:\"default:true\""
        }
      }
    },
    "CreditEvents": {
      "type": "object",
      "properties": {
        "AccountId": {
          "type": "string",
          "x-go-custom-tag": "gorm:\"index\""
        },
        "AuthorizedBy": {
          "type": "string"
        },
        "Delta": {
          "type": "number",
          "format": "double",
          "x-go-custom-tag": "gorm:\"type:numeric(23,13);default:0.0\""
        },
        "EventType": {
          "type": "string",
          "default": "Consumption",
          "enum": [
            "AuthorizedIncrease",
            "AuthorizedDecrease",
            "Consumption",
            "AutomaticCreditExpiry",
            "Refund"
          ],
          "x-go-custom-tag": "gorm:\"index;default:Consumption\""
        },
        "ID": {
          "type": "integer",
          "x-go-custom-tag": "gorm:\"primary_key\""
        },
        "Medium": {
          "type": "string",
          "default": "CREDIT",
          "enum": [
            "CREDIT",
            "CASH"
          ],
          "x-go-custom-tag": "gorm:\"index;default:CREDIT\""
        },
        "Timestamp": {
          "type": "string",
          "format": "datetime",
          "x-go-custom-tag": "gorm:\"type:timestamptz\""
        }
      }
    },
    "CreditHistory": {
      "type": "object",
      "properties": {
        "AccountID": {
          "type": "string",
          "x-go-custom-tag": "gorm:\"primary_key\""
        },
        "Events": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Event"
          }
        }
      }
    },
    "CreditStatus": {
      "type": "object",
      "properties": {
        "AccountID": {
          "type": "string",
          "x-go-custom-tag": "gorm:\"primary_key\""
        },
        "AvailableCash": {
          "type": "number",
          "format": "double",
          "x-go-custom-tag": "gorm:\"type:numeric(23,13);default:0.0\""
        },
        "AvailableCredit": {
          "type": "number",
          "format": "double",
          "x-go-custom-tag": "gorm:\"type:numeric(23,13);default:0.0\""
        },
        "LastUpdate": {
          "type": "string",
          "format": "datetime",
          "x-go-custom-tag": "gorm:\"type:timestamptz\""
        }
      }
    },
    "ErrorResponse": {
      "type": "object",
      "required": [
        "errorString"
      ],
      "properties": {
        "errorString": {
          "type": "string"
        }
      }
    },
    "Event": {
      "type": "object",
      "properties": {
        "AuthorizedBy": {
          "type": "string"
        },
        "Delta": {
          "type": "number",
          "format": "double",
          "x-go-custom-tag": "gorm:\"type:numeric(23,13);default:0.0\""
        },
        "EventType": {
          "type": "string",
          "default": "Consumption",
          "enum": [
            "AuthorizedIncrease",
            "AuthorizedDecrease",
            "Consumption",
            "AutomaticCreditExpiry",
            "Refund"
          ],
          "x-go-custom-tag": "gorm:\"index;default:Consumption\""
        },
        "Medium": {
          "type": "string",
          "default": "CREDIT",
          "enum": [
            "CREDIT",
            "CASH"
          ],
          "x-go-custom-tag": "gorm:\"index;default:CREDIT\""
        },
        "Timestamp": {
          "type": "string",
          "format": "datetime",
          "x-go-custom-tag": "gorm:\"type:timestamptz\""
        }
      }
    },
    "Status": {
      "type": "object",
      "required": [
        "SystemState"
      ],
      "properties": {
        "AverageResponseTime": {
          "type": "number",
          "format": "double"
        },
        "DBState": {
          "type": "string"
        },
        "LastRequest": {
          "type": "string"
        },
        "RequestsBoT": {
          "type": "integer"
        },
        "RequestsLastHour": {
          "type": "integer"
        },
        "RequestsToday": {
          "type": "integer"
        },
        "SystemState": {
          "type": "string"
        }
      }
    }
  },
  "securityDefinitions": {
    "APIKeyHeader": {
      "type": "apiKey",
      "name": "X-API-KEY",
      "in": "header"
    },
    "APIKeyParam": {
      "type": "apiKey",
      "name": "api_key",
      "in": "query"
    },
    "Keycloak": {
      "type": "oauth2",
      "flow": "accessCode",
      "authorizationUrl": "http://localhost:8080/auth/realms/Dev/protocol/openid-connect/auth",
      "tokenUrl": "http://localhost:8080/auth/realms/Dev/protocol/openid-connect/token",
      "scopes": {
        "admin": "Admin scope",
        "user": "User scope"
      }
    }
  },
  "security": [
    {
      "Keycloak": [
        "user",
        "admin"
      ]
    },
    {
      "APIKeyHeader": []
    },
    {
      "APIKeyParam": []
    }
  ],
  "tags": [
    {
      "description": "Actions relating to the reporting of the state of the service",
      "name": "statusManagement"
    },
    {
      "description": "Actions relating to the periodics actions to be triggered in the system",
      "name": "triggerManagement"
    },
    {
      "description": "Actions relating to the control of the credits per account",
      "name": "creditManagement"
    },
    {
      "description": "Actions relating to the account management in the service",
      "name": "accountManagement"
    }
  ]
}`))
	FlatSwaggerJSON = json.RawMessage([]byte(`{
  "schemes": [
    "http",
    "https"
  ],
  "swagger": "2.0",
  "info": {
    "description": "An API which supports creation, deletion, listing etc of Credit Manager",
    "title": "Credit Manager Management API",
    "contact": {
      "email": "diego@cyclops-labs.io"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "1.0.0"
  },
  "host": "localhost:8000",
  "basePath": "/api/v1.0",
  "paths": {
    "/account/available/{id}": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "creditManagement"
        ],
        "summary": "Credit status of the account with the provided id",
        "operationId": "getCredit",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be checked",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Credit status of the account with the provided id",
            "schema": {
              "$ref": "#/definitions/CreditStatus"
            }
          },
          "404": {
            "description": "The account with the provided id doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/account/create/{id}": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "admin"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "accountManagement"
        ],
        "summary": "Creates a new account in the system",
        "operationId": "createAccount",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be created",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Account created, provided information of the new item created",
            "schema": {
              "$ref": "#/definitions/AccountStatus"
            }
          },
          "409": {
            "description": "The account with the id provided already exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/account/disable/{id}": {
      "post": {
        "security": [
          {
            "Keycloak": [
              "admin"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "accountManagement"
        ],
        "summary": "Disables the account with the id provided in the system",
        "operationId": "disableAccount",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be disabled",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Status information of the account with provided id in the system after the operation succeded",
            "schema": {
              "$ref": "#/definitions/AccountStatus"
            }
          },
          "404": {
            "description": "The account with the id provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/account/enable/{id}": {
      "post": {
        "security": [
          {
            "Keycloak": [
              "admin"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "accountManagement"
        ],
        "summary": "Enables the account with the id provided in the system",
        "operationId": "enableAccount",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be enabled",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Status information of the account with provided id in the system after the operation succeded",
            "schema": {
              "$ref": "#/definitions/AccountStatus"
            }
          },
          "404": {
            "description": "The account with the id provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/account/list": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "accountManagement"
        ],
        "summary": "List of the accounts in the system",
        "operationId": "listAccounts",
        "responses": {
          "200": {
            "description": "List of accounts in the system",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/AccountStatus"
              }
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/account/status/{id}": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "accountManagement"
        ],
        "summary": "Basic status of the account with the id provided in the system",
        "operationId": "getAccountStatus",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be checked",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Status information of the account with provided id in the system",
            "schema": {
              "$ref": "#/definitions/AccountStatus"
            }
          },
          "404": {
            "description": "The account with the id provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/history/{id}": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "creditManagement"
        ],
        "summary": "Credit history of the customer with id",
        "operationId": "getHistory",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to get the history",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "type": "boolean",
            "description": "Boolean variable to control if the system consumptions have to be listed or not",
            "name": "filterSystem",
            "in": "query"
          },
          {
            "enum": [
              "credit",
              "cash"
            ],
            "type": "string",
            "description": "Medium (cash/credit) to be used as filter",
            "name": "medium",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Credit status history of the account with the provided id",
            "schema": {
              "$ref": "#/definitions/CreditHistory"
            }
          },
          "404": {
            "description": "The endpoint provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/status": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "statusManagement"
        ],
        "summary": "Basic status of the system",
        "operationId": "showStatus",
        "responses": {
          "200": {
            "description": "Status information of the system",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        }
      }
    },
    "/status/{id}": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "statusManagement"
        ],
        "summary": "Basic status of the system",
        "operationId": "getStatus",
        "parameters": [
          {
            "enum": [
              "kafka-receiver",
              "kafka-sender",
              "status",
              "trigger",
              "account",
              "credit"
            ],
            "type": "string",
            "description": "Id of the endpoint to be checked",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Status information of the system",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          },
          "404": {
            "description": "The endpoint provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/trigger/sample": {
      "get": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "triggerManagement"
        ],
        "summary": "Sample task trigger",
        "operationId": "execSample",
        "responses": {
          "200": {
            "description": "Sample task executed successfully"
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/{medium}/available/decrease/{id}": {
      "post": {
        "security": [
          {
            "Keycloak": [
              "admin"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "creditManagement"
        ],
        "summary": "Insert a new reseller in the system.",
        "operationId": "decreaseCredit",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be checked",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "type": "number",
            "format": "double",
            "description": "Amount to be decreased",
            "name": "amount",
            "in": "query",
            "required": true
          },
          {
            "enum": [
              "credit",
              "cash"
            ],
            "type": "string",
            "description": "Medium (cash/credit) to be used in the accounting",
            "name": "medium",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Credit status of the account with the provided id",
            "schema": {
              "$ref": "#/definitions/CreditStatus"
            }
          },
          "404": {
            "description": "The account with the id provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/{medium}/available/increase/{id}": {
      "post": {
        "security": [
          {
            "Keycloak": [
              "admin"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "creditManagement"
        ],
        "summary": "Insert a new reseller in the system.",
        "operationId": "increaseCredit",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be checked",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "type": "number",
            "format": "double",
            "description": "Amount to be inccreased",
            "name": "amount",
            "in": "query",
            "required": true
          },
          {
            "enum": [
              "credit",
              "cash"
            ],
            "type": "string",
            "description": "Medium (cash/credit) to be used in the accounting",
            "name": "medium",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Credit status of the account with the provided id",
            "schema": {
              "$ref": "#/definitions/CreditStatus"
            }
          },
          "404": {
            "description": "The account with the id provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/{medium}/consume/{id}": {
      "post": {
        "security": [
          {
            "Keycloak": [
              "user"
            ]
          },
          {
            "APIKeyHeader": []
          },
          {
            "APIKeyParam": []
          }
        ],
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "creditManagement"
        ],
        "summary": "Adds a consumption to the system",
        "operationId": "addConsumption",
        "parameters": [
          {
            "type": "string",
            "description": "Id of the account to be checked",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "type": "number",
            "format": "double",
            "description": "Amount to be decreased",
            "name": "amount",
            "in": "query",
            "required": true
          },
          {
            "enum": [
              "credit",
              "cash"
            ],
            "type": "string",
            "description": "Medium (cash/credit) to be used in the accounting",
            "name": "medium",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Credit status of the account with the provided id",
            "schema": {
              "$ref": "#/definitions/CreditStatus"
            }
          },
          "404": {
            "description": "The account with the id provided doesn't exist",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Something unexpected happend, error raised",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "AccountStatus": {
      "type": "object",
      "required": [
        "Enabled"
      ],
      "properties": {
        "AccountID": {
          "type": "string",
          "x-go-custom-tag": "gorm:\"primary_key\""
        },
        "CreatedAt": {
          "type": "string",
          "format": "datetime",
          "x-go-custom-tag": "gorm:\"type:timestamptz\""
        },
        "Enabled": {
          "type": "boolean",
          "default": true,
          "x-go-custom-tag": "gorm:\"default:true\""
        }
      }
    },
    "CreditEvents": {
      "type": "object",
      "properties": {
        "AccountId": {
          "type": "string",
          "x-go-custom-tag": "gorm:\"index\""
        },
        "AuthorizedBy": {
          "type": "string"
        },
        "Delta": {
          "type": "number",
          "format": "double",
          "x-go-custom-tag": "gorm:\"type:numeric(23,13);default:0.0\""
        },
        "EventType": {
          "type": "string",
          "default": "Consumption",
          "enum": [
            "AuthorizedIncrease",
            "AuthorizedDecrease",
            "Consumption",
            "AutomaticCreditExpiry",
            "Refund"
          ],
          "x-go-custom-tag": "gorm:\"index;default:Consumption\""
        },
        "ID": {
          "type": "integer",
          "x-go-custom-tag": "gorm:\"primary_key\""
        },
        "Medium": {
          "type": "string",
          "default": "CREDIT",
          "enum": [
            "CREDIT",
            "CASH"
          ],
          "x-go-custom-tag": "gorm:\"index;default:CREDIT\""
        },
        "Timestamp": {
          "type": "string",
          "format": "datetime",
          "x-go-custom-tag": "gorm:\"type:timestamptz\""
        }
      }
    },
    "CreditHistory": {
      "type": "object",
      "properties": {
        "AccountID": {
          "type": "string",
          "x-go-custom-tag": "gorm:\"primary_key\""
        },
        "Events": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Event"
          }
        }
      }
    },
    "CreditStatus": {
      "type": "object",
      "properties": {
        "AccountID": {
          "type": "string",
          "x-go-custom-tag": "gorm:\"primary_key\""
        },
        "AvailableCash": {
          "type": "number",
          "format": "double",
          "x-go-custom-tag": "gorm:\"type:numeric(23,13);default:0.0\""
        },
        "AvailableCredit": {
          "type": "number",
          "format": "double",
          "x-go-custom-tag": "gorm:\"type:numeric(23,13);default:0.0\""
        },
        "LastUpdate": {
          "type": "string",
          "format": "datetime",
          "x-go-custom-tag": "gorm:\"type:timestamptz\""
        }
      }
    },
    "ErrorResponse": {
      "type": "object",
      "required": [
        "errorString"
      ],
      "properties": {
        "errorString": {
          "type": "string"
        }
      }
    },
    "Event": {
      "type": "object",
      "properties": {
        "AuthorizedBy": {
          "type": "string"
        },
        "Delta": {
          "type": "number",
          "format": "double",
          "x-go-custom-tag": "gorm:\"type:numeric(23,13);default:0.0\""
        },
        "EventType": {
          "type": "string",
          "default": "Consumption",
          "enum": [
            "AuthorizedIncrease",
            "AuthorizedDecrease",
            "Consumption",
            "AutomaticCreditExpiry",
            "Refund"
          ],
          "x-go-custom-tag": "gorm:\"index;default:Consumption\""
        },
        "Medium": {
          "type": "string",
          "default": "CREDIT",
          "enum": [
            "CREDIT",
            "CASH"
          ],
          "x-go-custom-tag": "gorm:\"index;default:CREDIT\""
        },
        "Timestamp": {
          "type": "string",
          "format": "datetime",
          "x-go-custom-tag": "gorm:\"type:timestamptz\""
        }
      }
    },
    "Status": {
      "type": "object",
      "required": [
        "SystemState"
      ],
      "properties": {
        "AverageResponseTime": {
          "type": "number",
          "format": "double"
        },
        "DBState": {
          "type": "string"
        },
        "LastRequest": {
          "type": "string"
        },
        "RequestsBoT": {
          "type": "integer"
        },
        "RequestsLastHour": {
          "type": "integer"
        },
        "RequestsToday": {
          "type": "integer"
        },
        "SystemState": {
          "type": "string"
        }
      }
    }
  },
  "securityDefinitions": {
    "APIKeyHeader": {
      "type": "apiKey",
      "name": "X-API-KEY",
      "in": "header"
    },
    "APIKeyParam": {
      "type": "apiKey",
      "name": "api_key",
      "in": "query"
    },
    "Keycloak": {
      "type": "oauth2",
      "flow": "accessCode",
      "authorizationUrl": "http://localhost:8080/auth/realms/Dev/protocol/openid-connect/auth",
      "tokenUrl": "http://localhost:8080/auth/realms/Dev/protocol/openid-connect/token",
      "scopes": {
        "admin": "Admin scope",
        "user": "User scope"
      }
    }
  },
  "security": [
    {
      "Keycloak": [
        "user",
        "admin"
      ]
    },
    {
      "APIKeyHeader": []
    },
    {
      "APIKeyParam": []
    }
  ],
  "tags": [
    {
      "description": "Actions relating to the reporting of the state of the service",
      "name": "statusManagement"
    },
    {
      "description": "Actions relating to the periodics actions to be triggered in the system",
      "name": "triggerManagement"
    },
    {
      "description": "Actions relating to the control of the credits per account",
      "name": "creditManagement"
    },
    {
      "description": "Actions relating to the account management in the service",
      "name": "accountManagement"
    }
  ]
}`))
}
