{
    "openapi": "3.0.0",
    "info": {
        "title": "LWSPORTAL",
        "description": "API documentation",
        "version": "v0.1.1 (04/09/2024)"
    },
    "servers": [
        {
            "url": "http://lwsportal.api",
            "description": ""
        }
    ],
    "paths": {
        "/api/v1/admin/me": {
            "get": {
                "tags": [
                    "Admin / Account"
                ],
                "summary": "Get My Profile",
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AccountAdminDTO"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/admin/me/password": {
            "put": {
                "tags": [
                    "Admin / Account"
                ],
                "summary": "Change My Password",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "password": {
                                        "type": "string"
                                    },
                                    "confirm_password": {
                                        "type": "string"
                                    },
                                    "old_password": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "messsage": {
                                            "type": "string",
                                            "example": "Success!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/admin/admins": {
            "get": {
                "tags": [
                    "Admin / Admin"
                ],
                "summary": "Get List Admins",
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/AccountAdminDTO"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/admin/admins/{id}": {
            "get": {
                "tags": [
                    "Admin / Admin"
                ],
                "summary": "Get My Profile",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Admin ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AccountAdminDTO"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/admin/login": {
            "post": {
                "tags": [
                    "Admin / Auth"
                ],
                "summary": "Login",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "username": {
                                        "type": "string"
                                    },
                                    "password": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "is_first_login": {
                                            "type": "string",
                                            "example": "true"
                                        },
                                        "secret_key": {
                                            "type": "string",
                                            "example": "H3ANBFOQULFGGPTQ"
                                        },
                                        "qr_code": {
                                            "type": "string",
                                            "example": "data:image/svg+xml;base64,..."
                                        },
                                        "token_type": {
                                            "type": "string",
                                            "example": "Bearer"
                                        },
                                        "expires_in": {
                                            "type": "string",
                                            "example": "31536000"
                                        },
                                        "access_token": {
                                            "type": "string",
                                            "example": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9..."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/admin/verify-otp": {
            "post": {
                "tags": [
                    "Admin / Auth"
                ],
                "summary": "Verify OTP after login",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "otp": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "true"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "success"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/user/me": {
            "get": {
                "tags": [
                    "User / Account"
                ],
                "summary": "Get My Profile",
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AccountUserDTO"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "AccountModel": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "minimum": "1"
                    },
                    "username": {
                        "type": "string",
                        "format": "email"
                    },
                    "password": {
                        "type": "string",
                        "format": "password"
                    },
                    "scope": {
                        "type": "string"
                    },
                    "is_active": {
                        "type": "integer",
                        "example": "1"
                    },
                    "email_verified_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "last_login_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "type": "object"
            },
            "AccountAdminDTO": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "minimum": "1"
                    },
                    "username": {
                        "type": "string",
                        "format": "email"
                    },
                    "password": {
                        "type": "string",
                        "format": "password"
                    },
                    "scope": {
                        "type": "string"
                    },
                    "is_active": {
                        "type": "integer",
                        "example": "1"
                    },
                    "email_verified_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "last_login_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "admin": {
                        "$ref": "#/components/schemas/AdminModel"
                    },
                    "profile": {
                        "$ref": "#/components/schemas/ProfileModel"
                    }
                },
                "type": "object"
            },
            "AccountUserDTO": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "minimum": "1"
                    },
                    "username": {
                        "type": "string",
                        "format": "email"
                    },
                    "password": {
                        "type": "string",
                        "format": "password"
                    },
                    "scope": {
                        "type": "string"
                    },
                    "is_active": {
                        "type": "integer",
                        "example": "1"
                    },
                    "email_verified_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "last_login_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "user": {
                        "$ref": "#/components/schemas/UserModel"
                    },
                    "profile": {
                        "$ref": "#/components/schemas/ProfileModel"
                    }
                },
                "type": "object"
            },
            "AdminModel": {
                "required": [
                    "id",
                    "account_id"
                ],
                "properties": {
                    "id": {
                        "type": "integer",
                        "minimum": "1"
                    },
                    "acount_id": {
                        "type": "integer",
                        "minimum": "1"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "type": "object"
            },
            "ProfileModel": {
                "required": [
                    "id",
                    "account_id",
                    "firstname",
                    "lastname",
                    "phone",
                    "created_at"
                ],
                "properties": {
                    "id": {
                        "type": "integer",
                        "minimum": "1"
                    },
                    "acount_id": {
                        "type": "integer",
                        "minimum": "1"
                    },
                    "firstname": {
                        "type": "string"
                    },
                    "lastname": {
                        "type": "string"
                    },
                    "fullname": {
                        "type": "string"
                    },
                    "nickname": {
                        "type": "string"
                    },
                    "contact_email": {
                        "type": "string",
                        "format": "email"
                    },
                    "phone": {
                        "type": "string"
                    },
                    "avatar": {
                        "type": "string",
                        "format": "url"
                    },
                    "birthday": {
                        "type": "string"
                    },
                    "gender": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "datetime"
                    }
                },
                "type": "object"
            },
            "ProfileUpdateDTO": {
                "properties": {
                    "firstname": {
                        "nullable": true,
                        "description": "Sometimes required",
                        "type": "string"
                    },
                    "lastname": {
                        "nullable": true,
                        "description": "Sometimes required",
                        "type": "string"
                    },
                    "nickname": {
                        "nullable": true,
                        "type": "string"
                    },
                    "contact_email": {
                        "nullable": true,
                        "type": "string",
                        "format": "email"
                    },
                    "phone": {
                        "nullable": true,
                        "description": "Sometimes required",
                        "type": "string"
                    },
                    "avatar": {
                        "nullable": true,
                        "type": "string"
                    },
                    "birthday": {
                        "nullable": true,
                        "type": "string"
                    },
                    "gender": {
                        "nullable": true,
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "UserModel": {
                "required": [
                    "id",
                    "account_id"
                ],
                "properties": {
                    "id": {
                        "type": "integer",
                        "minimum": "1"
                    },
                    "acount_id": {
                        "type": "integer",
                        "minimum": "1"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "JWT",
                "description": "Enter your Bearer token in the format: Bearer {token}"
            }
        }
    }
}