{
    "openapi": "3.0.0",
    "info": {
        "title": "E-Finance API Docs",
        "description": "E-Finance API Documentation using Swagger. Created By @rshme",
        "termsOfService": "http://swagger.io/terms/",
        "contact": {
            "email": "rafiseptian90@gmail.com"
        },
        "license": {
            "name": "Apache 2.0",
            "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
        },
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "api/v1"
        }
    ],
    "paths": {
        "/auth/login": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Login",
                "description": "User Authentication",
                "operationId": "login",
                "requestBody": {
                    "description": "Pass user credentials",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "username",
                                    "password"
                                ],
                                "properties": {
                                    "username": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "user1"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "PassWord12345"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "401": {
                        "description": "Unsuccessfully Login"
                    }
                }
            }
        },
        "/auth/register": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Register",
                "description": "Register new employee",
                "operationId": "register",
                "requestBody": {
                    "description": "Register request body",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name",
                                    "username",
                                    "password",
                                    "role"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "John Doe"
                                    },
                                    "username": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "johndoe123"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "JohnDoe&%^22$33"
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "john.doe@gmail.com"
                                    },
                                    "phone": {
                                        "type": "int32",
                                        "format": "integer",
                                        "example": "087824232432"
                                    },
                                    "role": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "User"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable Entity"
                    }
                }
            }
        },
        "/auth/logout": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Logout",
                "description": "User Logout",
                "operationId": "logout",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/auth/change-password": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Change password",
                "description": "Change user password",
                "operationId": "change_password",
                "requestBody": {
                    "description": "Change password request body",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "old_password",
                                    "new_password",
                                    "new_password_confirmation"
                                ],
                                "properties": {
                                    "old_password": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "UserOldPassword"
                                    },
                                    "new_password": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "UserNewPassword"
                                    },
                                    "new_password_confirmation": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "UserNewPassword"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable Entity"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/auth/profile": {
            "get": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Grab user profile",
                "description": "User can see their profile",
                "operationId": "get_profile",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Update user profile",
                "description": "Admin and User can update a user profile, but when the role is User, that user can't change their role",
                "operationId": "update_profile",
                "requestBody": {
                    "description": "Update profile request body",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name",
                                    "username"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "Richard Roe"
                                    },
                                    "username": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "RichardRoe"
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "RichardRoe@gmail.com"
                                    },
                                    "phone": {
                                        "type": "int32",
                                        "format": "integer",
                                        "example": "087832332132"
                                    },
                                    "role": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "User"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable Entity"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/cashflow": {
            "get": {
                "tags": [
                    "Cashflow"
                ],
                "summary": "All data cashflow",
                "description": "Grab all data cashflow by year",
                "operationId": "all_cashflow",
                "parameters": [
                    {
                        "name": "year",
                        "in": "query",
                        "description": "Year that want to be showing the cashflow",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {

                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Year must be filled"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Cashflow"
                ],
                "summary": "Store new cashflow",
                "operationId": "create_cashflow",
                "requestBody": {
                    "description": "Request body for store a cashflow",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "employee_id",
                                    "company_id",
                                    "type",
                                    "paid_to",
                                    "date"
                                ],
                                "properties": {
                                    "employee_id": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "509A919F-4D7B-480C-9353-11631D2E6A76"
                                    },
                                    "company_id": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "A5C68831-0E36-439F-B97E-4274D715B833"
                                    },
                                    "type": {
                                        "type": "string",
                                        "format": "string",
                                        "enum": [
                                            "credit",
                                            "debit"
                                        ]
                                    },
                                    "credit": {
                                        "type": "int32",
                                        "format": "integer",
                                        "example": 100000
                                    },
                                    "debit": {
                                        "type": "int32",
                                        "format": "integer",
                                        "example": 0
                                    },
                                    "paid_to": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "John Doe"
                                    },
                                    "date": {
                                        "type": "string",
                                        "format": "date",
                                        "example": "01-01-2021"
                                    },
                                    "description": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "Fill the description"
                                    },
                                    "items": {
                                        "type": "array",
                                        "items": {
                                            "properties": {
                                                "title": {
                                                    "type": "string",
                                                    "example": "Cashflow item title"
                                                },
                                                "amount": {
                                                    "type": "number",
                                                    "example": "100000"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "example": [
                                            {
                                                "title": "Item title",
                                                "amount": 100000
                                            }
                                        ]
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable Entity"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/cashflow-temporary": {
            "get": {
                "tags": [
                    "Cashflow Temporary"
                ],
                "summary": "All data cashflow temporary",
                "description": "Grab all data cashflow temporary by year",
                "operationId": "all_cashflow_temporary",
                "parameters": [
                    {
                        "name": "year",
                        "in": "query",
                        "description": "Year that want to be showing the cashflow temporary",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "400": {
                        "description": "Year must be filled"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Cashflow Temporary"
                ],
                "summary": "Store new cashflow temporary",
                "operationId": "create_cashflow_temporary",
                "requestBody": {
                    "description": "Request body for store a cashflow temporary",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "employee_id",
                                    "company_id",
                                    "type",
                                    "paid_to",
                                    "date"
                                ],
                                "properties": {
                                    "employee_id": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "509A919F-4D7B-480C-9353-11631D2E6A76"
                                    },
                                    "company_id": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "A5C68831-0E36-439F-B97E-4274D715B833"
                                    },
                                    "type": {
                                        "type": "string",
                                        "format": "string",
                                        "enum": [
                                            "credit",
                                            "debit"
                                        ]
                                    },
                                    "credit": {
                                        "type": "int32",
                                        "format": "integer",
                                        "example": 100000
                                    },
                                    "debit": {
                                        "type": "int32",
                                        "format": "integer",
                                        "example": 0
                                    },
                                    "paid_to": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "John Doe"
                                    },
                                    "date": {
                                        "type": "string",
                                        "format": "date",
                                        "example": "01-01-2021"
                                    },
                                    "description": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "Fill the description"
                                    },
                                    "items": {
                                        "type": "array",
                                        "items": {
                                            "properties": {
                                                "title": {
                                                    "type": "string",
                                                    "example": "Cashflow item title"
                                                },
                                                "amount": {
                                                    "type": "number",
                                                    "example": "100000"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "example": [
                                            {
                                                "title": "Item title",
                                                "amount": 100000
                                            }
                                        ]
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable Entity"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/cashflow/{cashflow_id}": {
            "get": {
                "tags": [
                    "Cashflow"
                ],
                "summary": "Detail cashflow",
                "description": "Grab detail cashflow by passing cashflow ID",
                "operationId": "show_company",
                "parameters": [
                    {
                        "name": "cashflow_id",
                        "in": "path",
                        "description": "The ID of cashflow that selected",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Cashflow ID not found"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Cashflow"
                ],
                "summary": "Update cashflow",
                "operationId": "update_cashflow",
                "parameters": [
                    {
                        "name": "cashflow_id",
                        "in": "path",
                        "description": "The ID of cashflow that selected",
                        "required": true
                    }
                ],
                "requestBody": {
                    "description": "Request body for update a cashflow",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "employee_id",
                                    "company_id",
                                    "type",
                                    "paid_to",
                                    "date"
                                ],
                                "properties": {
                                    "employee_id": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "509A919F-4D7B-480C-9353-11631D2E6A76"
                                    },
                                    "company_id": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "A5C68831-0E36-439F-B97E-4274D715B833"
                                    },
                                    "type": {
                                        "type": "string",
                                        "format": "string",
                                        "enum": [
                                            "credit",
                                            "debit"
                                        ]
                                    },
                                    "credit": {
                                        "type": "int32",
                                        "format": "integer",
                                        "example": 100000
                                    },
                                    "debit": {
                                        "type": "int32",
                                        "format": "integer",
                                        "example": 0
                                    },
                                    "paid_to": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "Jane Poe"
                                    },
                                    "date": {
                                        "type": "string",
                                        "format": "date",
                                        "example": "30-07-2021"
                                    },
                                    "description": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "Fill the description"
                                    },
                                    "items": {
                                        "type": "array",
                                        "items": {
                                            "properties": {
                                                "title": {
                                                    "type": "string",
                                                    "example": "Cashflow item title"
                                                },
                                                "amount": {
                                                    "type": "number",
                                                    "example": "100000"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "example": [
                                            {
                                                "title": "Item title",
                                                "amount": 100000
                                            }
                                        ]
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable Entity"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Cashflow"
                ],
                "summary": "Delete cashflow",
                "description": "Delete a cashflow by their ID",
                "operationId": "delete_cashflow",
                "parameters": [
                    {
                        "name": "cashflow_id",
                        "in": "path",
                        "description": "The ID of cashflow that selected",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Cashflow ID not found"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/company": {
            "get": {
                "tags": [
                    "Company"
                ],
                "summary": "All data company",
                "description": "Grab all data company by order ascending the name of company",
                "operationId": "all_company",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Company"
                ],
                "summary": "Store new company",
                "description": "Admin can create a new company",
                "operationId": "create_company",
                "requestBody": {
                    "description": "Request body for store a company",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "PT Sinx ID"
                                    },
                                    "npwp": {
                                        "type": "int32",
                                        "format": "integer",
                                        "example": 3231178309
                                    },
                                    "address": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "Jln. Ahmad Yani No.35, Jakarta Pusat"
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "admin@sinx.id"
                                    },
                                    "phone": {
                                        "type": "int32",
                                        "format": "integer",
                                        "example": 87965768678
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable Entity"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/cashflow/{company}/all": {
            "get": {
                "tags": [
                    "Cashflow"
                ],
                "summary": "All data cashflow by specific company",
                "description": "Grab all data cashflow by specific company that parsed",
                "operationId": "all_cashflow_by_company",
                "parameters": [
                    {
                        "name": "company",
                        "in": "path",
                        "description": "The ID of company that we need for grab all cashflow",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Company ID not found"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/company/{company_id}": {
            "get": {
                "tags": [
                    "Company"
                ],
                "summary": "Detail company",
                "description": "Grab detail company by passing company ID",
                "operationId": "show_company",
                "parameters": [
                    {
                        "name": "company_id",
                        "in": "path",
                        "description": "The ID of company that selected",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Company ID not found"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Company"
                ],
                "summary": "Update company",
                "description": "Update existing company",
                "operationId": "update_company",
                "parameters": [
                    {
                        "name": "company_id",
                        "in": "path",
                        "description": "The ID of company that will be updated",
                        "required": true
                    }
                ],
                "requestBody": {
                    "description": "Request body for store a company",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "PT Sinx ID"
                                    },
                                    "npwp": {
                                        "type": "int32",
                                        "format": "integer",
                                        "example": 3231178309
                                    },
                                    "address": {
                                        "type": "string",
                                        "format": "string",
                                        "example": "Jln. Ahmad Yani No.35, Jakarta Pusat"
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "admin@sinx.id"
                                    },
                                    "phone": {
                                        "type": "int32",
                                        "format": "integer",
                                        "example": 87965768678
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable Entity"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "404": {
                        "description": "Company ID not found"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Company"
                ],
                "summary": "Delete company",
                "description": "Delete a company by their ID",
                "operationId": "delete_company",
                "parameters": [
                    {
                        "name": "company_id",
                        "in": "path",
                        "description": "The ID of company that selected",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "Company ID not found"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/company/user/{user_id}": {
            "get": {
                "tags": [
                    "Company"
                ],
                "summary": "Company by User",
                "description": "Take company by user ID",
                "operationId": "show_user_company",
                "parameters": [
                    {
                        "name": "user_id",
                        "in": "path",
                        "description": "The ID of user that selected",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "404": {
                        "description": "User ID not found"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        }
    },
    "components": {
        "securitySchemes": {
            "api_key": {
                "type": "http",
                "description": "Pass Bearer token for the security",
                "name": "api_key",
                "in": "header",
                "scheme": "bearer",
                "bearerFormat": "JWT"
            }
        }
    },
    "security": [
        []
    ]
}
