{
  "openapi": "3.0.4",
  "info": {
    "title": "Local Authentication API",
    "version": "v1"
  },
  "servers": [
    {
      "url": "/token"
    }
  ],
  "paths": {
    "/": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "operationId": "Login",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateTokenByCredentialsRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateTokenByCredentialsRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateTokenByCredentialsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidTokenResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidTokenResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidTokenResponse"
                }
              }
            }
          }
        }
      }
    },
    "/by-action-query": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "operationId": "LoginByActionQuery",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActionQueryRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ActionQueryRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ActionQueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidTokenResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidTokenResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidTokenResponse"
                }
              }
            }
          }
        }
      }
    },
    "/validate": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "operationId": "ValidateToken",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateTokenRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateTokenRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateTokenResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateTokenResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateTokenResponse"
                }
              }
            }
          }
        }
      }
    },
    "/refresh": {
      "put": {
        "tags": [
          "Authentication"
        ],
        "operationId": "RefreshToken",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidTokenResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidTokenResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidTokenResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ActionQueryRequest": {
        "type": "object",
        "properties": {
          "encryptedQuery": {
            "type": "string",
            "nullable": true
          },
          "tenant": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GenerateTokenByCredentialsRequest": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string",
            "nullable": true
          },
          "password": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UserType": {
        "enum": [
          "WebUser",
          "Employee",
          "None"
        ],
        "type": "string"
      },
      "ValidTokenResponse": {
        "required": [
          "access_token",
          "token_type",
          "validFrom",
          "validTo"
        ],
        "type": "object",
        "properties": {
          "token_type": {
            "type": "string",
            "nullable": true
          },
          "access_token": {
            "type": "string",
            "nullable": true
          },
          "validFrom": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "validTo": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ValidateTokenRequest": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ValidateTokenResponse": {
        "type": "object",
        "properties": {
          "isValid": {
            "type": "boolean"
          },
          "userId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "clientId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "userType": {
            "$ref": "#/components/schemas/UserType"
          },
          "userName": {
            "type": "string",
            "nullable": true
          },
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "validFrom": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "validTo": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "companyIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "apiKey",
        "description": "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
        "name": "Authorization",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "Bearer": [ ]
    }
  ],
  "tags": [
    {
      "name": "Authentication"
    }
  ]
}