{
  "openapi": "3.0.1",
  "info": {
    "title": "Auth Service API's",
    "version": "v1"
  },
  "paths": {
    "/api/Account/Login": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "User Login — authenticates against Keycloak and returns tokens.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginModel"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginModel"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LoginModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Account/RefreshToken": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Refresh Token — exchanges a refresh token for a new access token.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefreshTokenModel"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RefreshTokenModel"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RefreshTokenModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Account/ForgotPassword": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Forgot Password — triggers Keycloak's password-reset email.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForgotPasswordModel"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ForgotPasswordModel"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ForgotPasswordModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Account/ChangeUserPasswordFromMail": {
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Change User Password From Mail (using a token from the reset-password link).",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeUserPasswordModelFromMail"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeUserPasswordModelFromMail"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeUserPasswordModelFromMail"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Account/ChangeUserPassword": {
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Change Password from system (requires current password).",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeUserPasswordModel"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeUserPasswordModel"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeUserPasswordModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Account/GetUserInfo": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Display logged-in User information.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Account/GetUserStores": {
      "get": {
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Account/UpdateUserInfo": {
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Update logged-in User information.",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": [
                  "FirstName",
                  "LastName"
                ],
                "type": "object",
                "properties": {
                  "Locale": {
                    "type": "string"
                  },
                  "FirstName": {
                    "type": "string"
                  },
                  "LastName": {
                    "type": "string"
                  },
                  "UserProfileImage": {
                    "type": "string",
                    "format": "binary"
                  },
                  "RemoveProfileImage": {
                    "type": "boolean"
                  },
                  "PhoneNumber": {
                    "pattern": "^\\+1[ -]?(\\d{3})[ -]?(\\d{3})[ -]?(\\d{4})$",
                    "type": "string"
                  },
                  "Department": {
                    "type": "string"
                  },
                  "DefaultStore": {
                    "type": "string"
                  },
                  "JobTitle": {
                    "type": "string"
                  }
                }
              },
              "encoding": {
                "Locale": {
                  "style": "form"
                },
                "FirstName": {
                  "style": "form"
                },
                "LastName": {
                  "style": "form"
                },
                "UserProfileImage": {
                  "style": "form"
                },
                "RemoveProfileImage": {
                  "style": "form"
                },
                "PhoneNumber": {
                  "style": "form"
                },
                "Department": {
                  "style": "form"
                },
                "DefaultStore": {
                  "style": "form"
                },
                "JobTitle": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Account/UpdateLocale": {
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Update user locale preference.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateLocaleModel"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateLocaleModel"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateLocaleModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Account/UpdateDarkTheme": {
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Update user dark theme preference.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDarkThemeModel"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDarkThemeModel"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDarkThemeModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Account/logout": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Logout — revokes the refresh token in Keycloak.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LogoutModel"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LogoutModel"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LogoutModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Admin/AddNewUser": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Admin can add new users to the system.",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": [
                  "Email",
                  "FirstName",
                  "LastName",
                  "Roles"
                ],
                "type": "object",
                "properties": {
                  "FirstName": {
                    "type": "string"
                  },
                  "LastName": {
                    "type": "string"
                  },
                  "Email": {
                    "type": "string",
                    "format": "email"
                  },
                  "ContactNumber": {
                    "pattern": "^\\+1[ -]?(\\d{3})[ -]?(\\d{3})[ -]?(\\d{4})$",
                    "type": "string"
                  },
                  "ProfileImage": {
                    "type": "string",
                    "format": "binary"
                  },
                  "RemoveProfileImage": {
                    "type": "boolean"
                  },
                  "Department": {
                    "type": "string"
                  },
                  "DefaultStore": {
                    "type": "string"
                  },
                  "JobTitle": {
                    "type": "string"
                  },
                  "Locale": {
                    "type": "string"
                  },
                  "Roles": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "Stores": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "encoding": {
                "FirstName": {
                  "style": "form"
                },
                "LastName": {
                  "style": "form"
                },
                "Email": {
                  "style": "form"
                },
                "ContactNumber": {
                  "style": "form"
                },
                "ProfileImage": {
                  "style": "form"
                },
                "RemoveProfileImage": {
                  "style": "form"
                },
                "Department": {
                  "style": "form"
                },
                "DefaultStore": {
                  "style": "form"
                },
                "JobTitle": {
                  "style": "form"
                },
                "Locale": {
                  "style": "form"
                },
                "Roles": {
                  "style": "form"
                },
                "Stores": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Admin/GetUsersList": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Get all user list (paginated, with optional search).",
        "parameters": [
          {
            "name": "Search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Page_No",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "Per_Page",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Admin/GetUserInfoByUserEmail": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Fetch user information by user email.",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Admin/UpdateUserInfoByUserEmail": {
      "put": {
        "tags": [
          "Admin"
        ],
        "summary": "Update user information by user email.",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": [
                  "Email",
                  "FirstName",
                  "LastName"
                ],
                "type": "object",
                "properties": {
                  "Email": {
                    "type": "string"
                  },
                  "Locale": {
                    "type": "string"
                  },
                  "FirstName": {
                    "type": "string"
                  },
                  "LastName": {
                    "type": "string"
                  },
                  "UserProfileImage": {
                    "type": "string",
                    "format": "binary"
                  },
                  "RemoveProfileImage": {
                    "type": "boolean"
                  },
                  "PhoneNumber": {
                    "pattern": "^\\+1[ -]?(\\d{3})[ -]?(\\d{3})[ -]?(\\d{4})$",
                    "type": "string"
                  },
                  "Department": {
                    "type": "string"
                  },
                  "DefaultStore": {
                    "type": "string"
                  },
                  "JobTitle": {
                    "type": "string"
                  },
                  "UpdateRoles": {
                    "type": "boolean"
                  },
                  "Roles": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "Stores": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "encoding": {
                "Email": {
                  "style": "form"
                },
                "Locale": {
                  "style": "form"
                },
                "FirstName": {
                  "style": "form"
                },
                "LastName": {
                  "style": "form"
                },
                "UserProfileImage": {
                  "style": "form"
                },
                "RemoveProfileImage": {
                  "style": "form"
                },
                "PhoneNumber": {
                  "style": "form"
                },
                "Department": {
                  "style": "form"
                },
                "DefaultStore": {
                  "style": "form"
                },
                "JobTitle": {
                  "style": "form"
                },
                "UpdateRoles": {
                  "style": "form"
                },
                "Roles": {
                  "style": "form"
                },
                "Stores": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Admin/ActiveDeactiveUser": {
      "put": {
        "tags": [
          "Admin"
        ],
        "summary": "Admin can active/deactive user.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivateUserModel"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivateUserModel"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ActivateUserModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Admin/GetAllRoles": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Get all available roles in Keycloak.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Admin/GetAllStores": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Get all available groups/stores in Keycloak.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/Health": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Health check endpoint - returns 200 OK if service is running and database is accessible",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ActivateUserModel": {
        "required": [
          "email",
          "isUserActive"
        ],
        "type": "object",
        "properties": {
          "email": {
            "minLength": 1,
            "type": "string"
          },
          "isUserActive": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ChangeUserPasswordModel": {
        "required": [
          "confirmedPassword",
          "currentPassword",
          "newPassword"
        ],
        "type": "object",
        "properties": {
          "currentPassword": {
            "minLength": 1,
            "type": "string"
          },
          "newPassword": {
            "minLength": 1,
            "type": "string"
          },
          "confirmedPassword": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ChangeUserPasswordModelFromMail": {
        "required": [
          "confirmedPassword",
          "newPassword",
          "token"
        ],
        "type": "object",
        "properties": {
          "token": {
            "minLength": 1,
            "type": "string"
          },
          "newPassword": {
            "minLength": 1,
            "type": "string"
          },
          "confirmedPassword": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ForgotPasswordModel": {
        "required": [
          "email"
        ],
        "type": "object",
        "properties": {
          "email": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "LoginModel": {
        "required": [
          "email",
          "password"
        ],
        "type": "object",
        "properties": {
          "email": {
            "maxLength": 50,
            "minLength": 1,
            "type": "string",
            "format": "email",
            "default": "admin@admsport.com"
          },
          "password": {
            "maxLength": 50,
            "minLength": 1,
            "type": "string",
            "default": "Test123!"
          }
        },
        "additionalProperties": false
      },
      "LogoutModel": {
        "required": [
          "idToken",
          "refreshToken"
        ],
        "type": "object",
        "properties": {
          "refreshToken": {
            "minLength": 1,
            "type": "string"
          },
          "idToken": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "RefreshTokenModel": {
        "required": [
          "refreshToken"
        ],
        "type": "object",
        "properties": {
          "refreshToken": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "UpdateDarkThemeModel": {
        "required": [
          "isDarkTheme"
        ],
        "type": "object",
        "properties": {
          "isDarkTheme": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "UpdateLocaleModel": {
        "required": [
          "locale"
        ],
        "type": "object",
        "properties": {
          "locale": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "description": "Please enter a valid token",
        "scheme": "Bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "Bearer": [ ]
    }
  ]
}