{
  "openapi": "3.0.1",
  "info": {
    "title": "SSO Api",
    "description": "SSO auth api.",
    "version": "0.1.0",
    "contact": { "name": "Deepak", "email": "deepakkumar@cloudninecare.com" }
  },
  "paths": {
    "/api/v1/{userType}/admin/users": {
      "get": {
        "operationId": "findUser",
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FindUser200ResponseBody"
                }
              }
            }
          },
          "401": {
            "description": "Response for status 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FindUser401ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "hospitalId",
            "in": "query",
            "required": true,
            "schema": { "type": "number" },
            "description": "Hospital id",
            "explode": true
          },
          {
            "name": "group",
            "in": "query",
            "description": "Group name",
            "required": true,
            "explode": true,
            "schema": { "type": "string" }
          },
          {
            "name": "userType",
            "in": "path",
            "description": "User type internal or external user.",
            "required": true,
            "explode": true,
            "schema": { "type": "string", "default": "i", "enum": ["i"] }
          }
        ],
        "description": "Find users by group.",
        "summary": "Users list.",
        "tags": ["users"]
      },
      "post": {
        "operationId": "forceReCreateUser",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForceReCreateUserRequestBody"
              }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForceReCreateUser200ResponseBody"
                }
              }
            }
          },
          "401": {
            "description": "Response for status 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForceReCreateUser401ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "userType",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "default": "i", "enum": ["i"] },
            "description": "User type internal or external user.",
            "explode": true
          }
        ],
        "description": "Re-create a user in sso",
        "summary": "This will delete the previous and create new user in sso. Specially useful for dx-app users and to be integrated in AMS.",
        "tags": ["users", "admin"]
      }
    },
    "/api/v1/{userType}/admin/users/password": {
      "post": {
        "operationId": "syncAMSPassword",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SyncAMSPasswordRequestBody"
              }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyncAMSPassword200ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "x-api-key",
            "in": "header",
            "required": true,
            "schema": { "type": "string" },
            "description": "S2S api key for sso",
            "explode": false
          },
          {
            "name": "userType",
            "in": "path",
            "description": "User type internal or external user.",
            "required": true,
            "explode": true,
            "schema": { "type": "string", "default": "i", "enum": ["i"] }
          }
        ],
        "description": "Sync AMS password",
        "summary": "Sync AMS password to cognito. This is useful where user has changed password in AMS while having cognito access too.",
        "tags": ["password"]
      }
    },
    "/api/v1/{userType}/login": {
      "post": {
        "operationId": "login",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/LoginRequestBody" }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Login200ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "x-user-source",
            "in": "header",
            "required": false,
            "schema": { "type": "string", "enum": ["ams", "cognito"] },
            "description": "User base source as like as ams/ip.",
            "explode": true
          },
          {
            "name": "x-user",
            "in": "header",
            "description": "User type like as doctors, Only required if x-user-source is ams.",
            "required": false,
            "explode": true,
            "schema": { "type": "string", "enum": ["doctors"] }
          },
          {
            "name": "x-app",
            "in": "header",
            "description": "App like as cx/dx/er, Will be used in tracking.",
            "required": false,
            "explode": true,
            "schema": {
              "type": "string",
              "enum": ["cx", "dx", "er", "ip", "cce", "vc"]
            }
          },
          {
            "name": "userType",
            "in": "path",
            "description": "User type internal or external user.",
            "required": true,
            "explode": true,
            "schema": { "type": "string", "default": "i", "enum": ["i", "p"] }
          }
        ],
        "description": "Uniformed login where username will be any from email/mobile/username.To generate the login password only username input is required and then the received session in response and token in mobile/email.",
        "summary": "Login with username+password or username+otp",
        "tags": ["auth"]
      }
    },
    "/api/v1/{userType}/logout": {
      "post": {
        "operationId": "logout",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/LogoutRequestBody" }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Logout200ResponseBody"
                }
              }
            }
          },
          "401": {
            "description": "Response for status 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Logout401ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "userType",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "default": "i", "enum": ["i", "p"] },
            "description": "User type internal or external user.",
            "explode": true
          }
        ],
        "description": "Global logout from cognito to invalidate refresh token",
        "summary": "Logout",
        "tags": ["auth"]
      }
    },
    "/api/v1/{userType}/me": {
      "get": {
        "operationId": "getValidatedUserData",
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetValidatedUserData200ResponseBody"
                }
              }
            }
          },
          "401": {
            "description": "Response for status 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetValidatedUserData401ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "x-app",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "enum": ["fertility-legal", "kiosk-er", "cryonine", "querylight"]
            },
            "description": "Required for access",
            "explode": true
          },
          {
            "name": "userType",
            "in": "path",
            "description": "User type internal or external user.",
            "required": true,
            "explode": true,
            "schema": { "type": "string", "default": "i", "enum": ["i", "p"] }
          }
        ],
        "description": "Get validated token payload from a valid cognito jwt.",
        "summary": "Token data.",
        "tags": ["token"]
      }
    },
    "/api/v1/{userType}/password": {
      "put": {
        "operationId": "changePassword",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePasswordRequestBody"
              }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangePassword200ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "userType",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "default": "i", "enum": ["i", "p"] },
            "description": "User type internal or external user.",
            "explode": true
          }
        ],
        "description": "Change password with help of current valid password or token.",
        "summary": "Change password by current valid password or token.",
        "tags": ["password"]
      },
      "patch": {
        "operationId": "resetPassword",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResetPasswordRequestBody"
              }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResetPassword200ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "userType",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "default": "i", "enum": ["i", "p"] },
            "description": "User type internal or external user.",
            "explode": true
          }
        ],
        "description": "Reset password otp will be sent on email/mobile.",
        "summary": "Reset password.",
        "tags": ["password"]
      },
      "post": {
        "operationId": "updatePassword",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePasswordRequestBody"
              }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdatePassword200ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "userType",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "default": "i", "enum": ["i", "p"] },
            "description": "User type internal or external user.",
            "explode": true
          }
        ],
        "description": "Update password by otp and a new password. This is useful when user does not having a email id in the cognito profile.So, OTP will be send on the mobile.",
        "summary": "Update password.",
        "tags": ["password"]
      }
    },
    "/api/v1/{userType}/register": {
      "post": {
        "operationId": "register",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/RegisterRequestBody" }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Register200ResponseBody"
                }
              }
            }
          },
          "401": {
            "description": "Response for status 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Register401ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "x-app",
            "in": "header",
            "required": false,
            "schema": { "type": "string", "enum": ["ip", "ams"] },
            "description": "App like as ip/ams, Will be used in tracking.",
            "explode": true
          },
          {
            "name": "userType",
            "in": "path",
            "description": "User type internal or external user.",
            "required": true,
            "explode": true,
            "schema": { "type": "string", "default": "i", "enum": ["i"] }
          }
        ],
        "description": "Create user by admin from internal apps",
        "summary": "Register user",
        "tags": ["admin"]
      }
    },
    "/api/v1/{userType}/token": {
      "get": {
        "operationId": "getTokenData",
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetTokenData200ResponseBody"
                }
              }
            }
          },
          "401": {
            "description": "Response for status 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetTokenData401ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "userType",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "default": "i", "enum": ["i", "p"] },
            "description": "User type internal or external user.",
            "explode": true
          }
        ],
        "description": "Get token payload from a valid cognito jwt.",
        "summary": "Token data.",
        "tags": ["token"]
      }
    },
    "/api/v1/{userType}/token/{username}": {
      "patch": {
        "operationId": "refreshAccessToken",
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefreshAccessToken200ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "Username",
            "explode": true
          },
          {
            "name": "x-refresh-token",
            "in": "header",
            "required": true,
            "schema": { "type": "string" },
            "description": "Refresh Token",
            "explode": false
          },
          {
            "name": "userType",
            "in": "path",
            "description": "User type internal or external user.",
            "required": true,
            "explode": true,
            "schema": { "type": "string", "default": "i", "enum": ["i", "p"] }
          }
        ],
        "description": "Refresh access token with help of refresh token.",
        "summary": "Refresh access token.",
        "tags": ["token"]
      },
      "delete": {
        "operationId": "revokeRefreshToken",
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevokeRefreshToken200ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "Username",
            "explode": true
          },
          {
            "name": "x-refresh-token",
            "in": "header",
            "required": true,
            "schema": { "type": "string" },
            "description": "Refresh Token",
            "explode": false
          },
          {
            "name": "userType",
            "in": "path",
            "description": "User type internal or external user.",
            "required": true,
            "explode": true,
            "schema": { "type": "string", "default": "i", "enum": ["i", "p"] }
          }
        ],
        "description": "Revoke refresh token to bar from issuing new access access with help of this refresh token.",
        "summary": "Revoke refresh token.",
        "tags": ["token"]
      }
    },
    "/api/v1/{userType}/totp": {
      "put": {
        "operationId": "generateTOTPSecret",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateTOTPSecretRequestBody"
              }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateTOTPSecret200ResponseBody"
                }
              }
            }
          },
          "401": {
            "description": "Response for status 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateTOTPSecret401ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "userType",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "default": "i", "enum": ["i"] },
            "description": "User type internal or external user.",
            "explode": true
          }
        ],
        "description": "Generate TOTP secret to use with otp generator apps.",
        "summary": "TOTP Secret.",
        "tags": ["totp"]
      },
      "patch": {
        "operationId": "enableTOTP",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/EnableTOTPRequestBody" }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableTOTP200ResponseBody"
                }
              }
            }
          },
          "401": {
            "description": "Response for status 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableTOTP401ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "userType",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "default": "i", "enum": ["i"] },
            "description": "User type internal or external user.",
            "explode": true
          }
        ],
        "description": "OTP to enable TOTP.",
        "summary": "Enable TOTP.",
        "tags": ["totp"]
      },
      "delete": {
        "operationId": "disableTOTP",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DisableTOTPRequestBody"
              }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DisableTOTP200ResponseBody"
                }
              }
            }
          },
          "401": {
            "description": "Response for status 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DisableTOTP401ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "userType",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "default": "i", "enum": ["i"] },
            "description": "User type internal or external user.",
            "explode": true
          }
        ],
        "description": "Disable TOTP.",
        "summary": "Disable TOTP.",
        "tags": ["totp"]
      },
      "get": {
        "operationId": "getTOTPStatus",
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetTOTPStatus200ResponseBody"
                }
              }
            }
          },
          "401": {
            "description": "Response for status 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetTOTPStatus401ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "userType",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "default": "i", "enum": ["i"] },
            "description": "User type internal or external user.",
            "explode": true
          }
        ],
        "description": "Get status to control UI logic.",
        "summary": "Get TOTP Status.",
        "tags": ["totp"]
      }
    },
    "/api/v1/{userType}/users": {
      "get": {
        "operationId": "findUsersByGroup",
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FindUsersByGroup200ResponseBody"
                }
              }
            }
          },
          "401": {
            "description": "Response for status 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FindUsersByGroup401ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "hospitalId",
            "in": "query",
            "required": true,
            "schema": { "type": "number" },
            "description": "Hospital id",
            "explode": true
          },
          {
            "name": "group",
            "in": "query",
            "description": "Group name",
            "required": true,
            "explode": true,
            "schema": { "type": "string" }
          },
          {
            "name": "userType",
            "in": "path",
            "description": "User type internal or external user.",
            "required": true,
            "explode": true,
            "schema": { "type": "string", "default": "i", "enum": ["i"] }
          }
        ],
        "description": "Find users by group.",
        "summary": "Users list.",
        "tags": ["users"]
      },
      "post": {
        "operationId": "forceReCreateUser",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForceReCreateUserRequestBody"
              }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForceReCreateUser200ResponseBody"
                }
              }
            }
          },
          "401": {
            "description": "Response for status 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForceReCreateUser401ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "userType",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "default": "i", "enum": ["i"] },
            "description": "User type internal or external user.",
            "explode": true
          }
        ],
        "description": "Re-create a user in sso",
        "summary": "This will delete the previous and create new user in sso. Specially useful for dx-app users and to be integrated in AMS.",
        "tags": ["users", "admin"]
      }
    },
    "/api/v2/{userType}/de-board": {
      "delete": {
        "operationId": "deleteUsers",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteUsersRequestBody"
              }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteUsers200ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "x-app",
            "in": "header",
            "required": false,
            "schema": { "type": "string", "enum": ["ip", "ams"] },
            "description": "App like as ip/ams, Will be used in tracking.",
            "explode": true
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "S2S api key for sso",
            "required": true,
            "explode": false,
            "schema": { "type": "string" }
          },
          {
            "name": "userType",
            "in": "path",
            "description": "User type internal or external user.",
            "required": true,
            "explode": true,
            "schema": { "type": "string", "default": "i", "enum": ["i", "p"] }
          }
        ],
        "description": "Delete user by admin from internal apps",
        "summary": "Delete users",
        "tags": ["admin"]
      }
    },
    "/api/v2/{userType}/register": {
      "post": {
        "operationId": "registerUsers",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterUsersRequestBody"
              }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisterUsers200ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "x-app",
            "in": "header",
            "required": false,
            "schema": { "type": "string", "enum": ["ip", "ams"] },
            "description": "App like as ip/ams, Will be used in tracking.",
            "explode": true
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "S2S api key for sso",
            "required": true,
            "explode": false,
            "schema": { "type": "string" }
          },
          {
            "name": "userType",
            "in": "path",
            "description": "User type internal or external user.",
            "required": true,
            "explode": true,
            "schema": { "type": "string", "default": "i", "enum": ["i", "p"] }
          }
        ],
        "description": "Create user by admin from internal apps",
        "summary": "Register users",
        "tags": ["admin"]
      }
    },
    "/api/v2/{userType}/transfer": {
      "post": {
        "operationId": "transferUsers",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransferUsersRequestBody"
              }
            }
          },
          "description": "Api payload"
        },
        "responses": {
          "200": {
            "description": "Response for status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransferUsers200ResponseBody"
                }
              }
            }
          },
          "500": {
            "description": "An unknown error occurred, trying again might help.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorMessage" }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "x-app",
            "in": "header",
            "required": false,
            "schema": { "type": "string", "enum": ["ip", "ams"] },
            "description": "App like as ip/ams, Will be used in tracking.",
            "explode": true
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "S2S api key for sso",
            "required": true,
            "explode": false,
            "schema": { "type": "string" }
          },
          {
            "name": "userType",
            "in": "path",
            "description": "User type internal or external user.",
            "required": true,
            "explode": true,
            "schema": { "type": "string", "default": "i", "enum": ["i", "p"] }
          }
        ],
        "description": "Bulk transfer users to different centers (hospitals) by admin",
        "summary": "Bulk transfer users",
        "tags": ["admin"]
      }
    }
  },
  "components": {
    "schemas": {
      "ChangePassword200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "ChangePasswordRequestBody": {
        "type": "object",
        "properties": {
          "username": { "type": "string" },
          "password": { "type": "string" },
          "newPassword": { "type": "string", "minLength": 6 }
        },
        "required": ["username", "password", "newPassword"],
        "additionalProperties": false,
        "description": "Api payload"
      },
      "DeleteUsers200ResponseBody": {
        "type": "object",
        "properties": {
          "status": { "type": "boolean" },
          "data": {},
          "message": { "type": "string" }
        },
        "required": ["status", "message"],
        "additionalProperties": false
      },
      "DeleteUsersRequestBody": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": { "username": { "type": "string" } },
          "required": ["username"],
          "additionalProperties": false
        },
        "description": "Api payload"
      },
      "DisableTOTP200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "DisableTOTP401ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "DisableTOTPRequestBody": {
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Api payload"
      },
      "EnableTOTP200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "EnableTOTP401ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "EnableTOTPRequestBody": {
        "type": "object",
        "properties": {
          "otp": { "type": "string", "minLength": 6, "maxLength": 6 }
        },
        "required": ["otp"],
        "additionalProperties": false,
        "description": "Api payload"
      },
      "ErrorMessage": {
        "type": "object",
        "properties": { "message": { "type": "string" } },
        "additionalProperties": false
      },
      "FindUser200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "FindUser401ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "FindUsersByGroup200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "FindUsersByGroup401ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "ForceReCreateUser200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "ForceReCreateUser401ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "ForceReCreateUserRequestBody": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string",
            "minLength": 3,
            "maxLength": 50,
            "pattern": "^[A-Za-z0-9@+._-]+$"
          }
        },
        "required": ["username"],
        "additionalProperties": false,
        "description": "Api payload"
      },
      "GenerateTOTPSecret200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "GenerateTOTPSecret401ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "GenerateTOTPSecretRequestBody": {
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Api payload"
      },
      "GetTOTPStatus200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "GetTOTPStatus401ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "GetTokenData200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "GetTokenData401ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "GetValidatedUserData200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "GetValidatedUserData401ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "Login200ResponseBody": {
        "type": "object",
        "properties": {
          "accessToken": { "type": "string" },
          "refreshToken": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["accessToken", "status"],
        "additionalProperties": false
      },
      "LoginRequestBody": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string",
            "minLength": 3,
            "maxLength": 50,
            "pattern": "^[A-Za-z0-9@+._-]+$"
          },
          "password": {
            "anyOf": [
              {
                "anyOf": [
                  { "not": {} },
                  {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 50,
                    "pattern": "^[^\\s]+$"
                  }
                ]
              },
              { "type": "string", "enum": [""] }
            ]
          },
          "session": { "type": "string" },
          "otp": {
            "anyOf": [
              {
                "anyOf": [
                  { "not": {} },
                  { "type": "string", "minLength": 6, "maxLength": 6 }
                ]
              },
              { "type": "string", "enum": [""] }
            ]
          },
          "faceImage": {
            "type": "object",
            "properties": {
              "sessionId": { "type": "string" },
              "deviceId": { "type": "string" }
            },
            "required": ["sessionId", "deviceId"],
            "additionalProperties": false,
            "nullable": true
          },
          "deviceId": { "type": "string" }
        },
        "required": ["username"],
        "additionalProperties": false,
        "description": "Api payload"
      },
      "Logout200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "Logout401ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "LogoutRequestBody": { "description": "Api payload" },
      "RefreshAccessToken200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "Register200ResponseBody": {
        "type": "object",
        "properties": {
          "status": { "type": "boolean" },
          "data": {},
          "message": { "type": "string" }
        },
        "required": ["status", "message"],
        "additionalProperties": false
      },
      "Register401ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "RegisterRequestBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "pattern": "^[A-Za-z0-9\\s]+$"
          },
          "email": { "type": "string", "format": "email" },
          "username": { "type": "string", "pattern": "^[A-Za-z0-9_-]+$" },
          "mobile": { "type": "string", "pattern": "^\\d{10}$" },
          "emp_id": { "type": "string" },
          "groups": { "type": "array", "items": { "type": "string" } },
          "role": { "type": "string", "minLength": 1 },
          "user_source": { "type": "string", "minLength": 1 },
          "hospitals": {
            "type": "array",
            "items": { "anyOf": [{ "type": "string" }, { "type": "number" }] }
          }
        },
        "required": [
          "name",
          "email",
          "mobile",
          "groups",
          "role",
          "user_source"
        ],
        "additionalProperties": false,
        "description": "Api payload"
      },
      "RegisterUsers200ResponseBody": {
        "type": "object",
        "properties": {
          "status": { "type": "boolean" },
          "data": {},
          "message": { "type": "string" }
        },
        "required": ["status", "message"],
        "additionalProperties": false
      },
      "RegisterUsersRequestBody": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 50,
              "pattern": "^[A-Za-z0-9\\s]+$"
            },
            "email": { "type": "string", "format": "email" },
            "username": { "type": "string", "pattern": "^[A-Za-z0-9_-]+$" },
            "mobile": { "type": "string", "pattern": "^\\d{10}$" },
            "emp_id": { "type": "string" },
            "groups": { "type": "array", "items": { "type": "string" } },
            "role": { "type": "string", "minLength": 1 },
            "user_source": { "type": "string", "minLength": 1 },
            "hospitals": {
              "type": "array",
              "items": { "anyOf": [{ "type": "string" }, { "type": "number" }] }
            }
          },
          "required": [
            "name",
            "email",
            "mobile",
            "groups",
            "role",
            "user_source"
          ],
          "additionalProperties": false
        },
        "description": "Api payload"
      },
      "ResetPassword200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "ResetPasswordRequestBody": {
        "type": "object",
        "properties": { "username": { "type": "string" } },
        "required": ["username"],
        "additionalProperties": false,
        "description": "Api payload"
      },
      "RevokeRefreshToken200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "SyncAMSPassword200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "SyncAMSPasswordRequestBody": {
        "type": "object",
        "properties": {
          "email": { "type": "string", "minLength": 3, "maxLength": 50 },
          "password": {
            "type": "string",
            "minLength": 6,
            "maxLength": 50,
            "pattern": "^[^\\s]+$"
          }
        },
        "required": ["email", "password"],
        "additionalProperties": false,
        "description": "Api payload"
      },
      "TransferUsers200ResponseBody": {
        "type": "object",
        "properties": {
          "status": { "type": "boolean" },
          "data": {},
          "message": { "type": "string" }
        },
        "required": ["status", "message"],
        "additionalProperties": false
      },
      "TransferUsersRequestBody": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "username": { "type": "string" },
            "email": { "type": "string" },
            "centers": {
              "type": "array",
              "items": {
                "anyOf": [{ "type": "string" }, { "type": "number" }]
              },
              "minItems": 1
            }
          },
          "required": ["centers"],
          "additionalProperties": false
        },
        "description": "Api payload"
      },
      "UpdatePassword200ResponseBody": {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "data": {},
          "err": { "type": "string" },
          "status": { "type": "boolean" }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "UpdatePasswordRequestBody": {
        "type": "object",
        "properties": {
          "username": { "type": "string" },
          "otp": { "type": "string" },
          "newPassword": { "type": "string", "minLength": 6 }
        },
        "required": ["username", "otp", "newPassword"],
        "additionalProperties": false,
        "description": "Api payload"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [{ "bearerAuth": [] }]
}
