{"openapi":"3.1.0","info":{"title":"PineBill API","description":"REST API for PineBill native clients, generated from the tRPC router. Authenticate with a Better Auth bearer session token.","version":"1.0.0"},"servers":[{"url":"https://www.pinebill.app/api/v1"}],"externalDocs":{"url":"https://www.pinebill.app/api/v1/docs"},"paths":{"/tasks":{"get":{"operationId":"listTasks","summary":"List tasks","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[{"in":"query","name":"page","schema":{"default":1,"type":"number","minimum":1}},{"in":"query","name":"pageSize","schema":{"default":25,"type":"number","minimum":1,"maximum":100}},{"in":"query","name":"search","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"default":"all","anyOf":[{"type":"string","enum":["TODO","IN_PROGRESS","REVIEW","DONE"]},{"type":"string","const":"all"}]}},{"in":"query","name":"projectId","schema":{"type":"string"}},{"in":"query","name":"assignedToId","schema":{"type":"string"}},{"in":"query","name":"dateFrom","schema":{"type":"string"}},{"in":"query","name":"dateTo","schema":{"type":"string"}},{"in":"query","name":"sortBy","schema":{"default":"createdAt","type":"string","enum":["title","status","startDate","dueDate","hourlyRate","createdAt"]}},{"in":"query","name":"sortOrder","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"tasks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":["string","null"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"TODO"},{"type":"string","const":"IN_PROGRESS"},{"type":"string","const":"REVIEW"},{"type":"string","const":"DONE"}]},"startDate":{"type":["string","null"]},"dueDate":{"type":["string","null"]},"currency":{"type":"string"},"notes":{"type":["string","null"]},"assignedToId":{"type":["string","null"]},"createdById":{"type":"string"},"totalTimeSpent":{"type":"number"},"isTimerRunning":{"type":"boolean"},"lastTimerStartedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"invoiceId":{"type":["string","null"]},"hourlyRate":{"type":["string","null"]},"assetCount":{"type":"number"},"_count":{"type":"object","properties":{"assets":{"type":"number"}},"required":["assets"],"additionalProperties":false},"assignedTo":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"project":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]}},"required":["id","organizationId","projectId","title","description","status","startDate","dueDate","currency","notes","assignedToId","createdById","totalTimeSpent","isTimerRunning","lastTimerStartedAt","createdAt","updatedAt","invoiceId","hourlyRate","assetCount","_count","assignedTo","project"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"currentPage":{"type":"number"},"pageSize":{"type":"number"},"totalCount":{"type":"number"},"totalPages":{"type":"number"},"hasNextPage":{"type":"boolean"},"hasPreviousPage":{"type":"boolean"}},"required":["currentPage","pageSize","totalCount","totalPages","hasNextPage","hasPreviousPage"],"additionalProperties":false}},"required":["tasks","pagination"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"post":{"operationId":"createTask","summary":"Create a task","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]},"status":{"default":"TODO","type":"string","enum":["TODO","IN_PROGRESS","REVIEW","DONE"]},"startDate":{"type":"string"},"dueDate":{"type":"string"},"hourlyRate":{"type":"number","minimum":0},"currency":{"default":"USD","type":"string","minLength":3,"maxLength":3},"notes":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]},"assignedToId":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]}},"required":["title"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"task":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":["string","null"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"TODO"},{"type":"string","const":"IN_PROGRESS"},{"type":"string","const":"REVIEW"},{"type":"string","const":"DONE"}]},"startDate":{"type":["string","null"]},"dueDate":{"type":["string","null"]},"currency":{"type":"string"},"notes":{"type":["string","null"]},"assignedToId":{"type":["string","null"]},"createdById":{"type":"string"},"totalTimeSpent":{"type":"number"},"isTimerRunning":{"type":"boolean"},"lastTimerStartedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"invoiceId":{"type":["string","null"]},"hourlyRate":{"type":["string","null"]}},"required":["id","organizationId","projectId","title","description","status","startDate","dueDate","currency","notes","assignedToId","createdById","totalTimeSpent","isTimerRunning","lastTimerStartedAt","createdAt","updatedAt","invoiceId","hourlyRate"],"additionalProperties":false}},"required":["success","task"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tasks/{id}":{"get":{"operationId":"getTask","summary":"Get a task by ID","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"assets":{"type":"array","items":{"type":"object","properties":{"uploadedBy":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"id":{"type":"string"},"taskId":{"type":"string"},"organizationId":{"type":"string"},"fileName":{"type":"string"},"s3Key":{"type":"string"},"s3Url":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"string"},"uploadedById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["uploadedBy","id","taskId","organizationId","fileName","s3Key","s3Url","contentType","size","uploadedById","createdAt","updatedAt"],"additionalProperties":false}},"assignedTo":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"position":{"type":["string","null"]}},"required":["id","name","position"],"additionalProperties":false},{"type":"null"}]},"createdBy":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"project":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"timerSessions":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"id":{"type":"string"},"taskId":{"type":"string"},"userId":{"type":"string"},"action":{"anyOf":[{"type":"string","const":"START"},{"type":"string","const":"STOP"},{"type":"string","const":"PAUSE"},{"type":"string","const":"RESUME"},{"type":"string","const":"MANUAL_ADD"},{"type":"string","const":"MANUAL_REMOVE"}]},"durationSeconds":{"type":["number","null"]},"note":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["user","id","taskId","userId","action","durationSeconds","note","createdAt"],"additionalProperties":false}},"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":["string","null"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"TODO"},{"type":"string","const":"IN_PROGRESS"},{"type":"string","const":"REVIEW"},{"type":"string","const":"DONE"}]},"startDate":{"type":["string","null"]},"dueDate":{"type":["string","null"]},"currency":{"type":"string"},"notes":{"type":["string","null"]},"assignedToId":{"type":["string","null"]},"createdById":{"type":"string"},"totalTimeSpent":{"type":"number"},"isTimerRunning":{"type":"boolean"},"lastTimerStartedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"invoiceId":{"type":["string","null"]},"hourlyRate":{"type":["string","null"]}},"required":["assets","assignedTo","createdBy","project","timerSessions","id","organizationId","projectId","title","description","status","startDate","dueDate","currency","notes","assignedToId","createdById","totalTimeSpent","isTimerRunning","lastTimerStartedAt","createdAt","updatedAt","invoiceId","hourlyRate"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"patch":{"operationId":"updateTask","summary":"Update a task","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"projectId":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]},"status":{"type":"string","enum":["TODO","IN_PROGRESS","REVIEW","DONE"]},"startDate":{"type":"string"},"dueDate":{"type":"string"},"hourlyRate":{"type":"number","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"notes":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]},"assignedToId":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]},"invoiceId":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]}}}},"required":["data"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"task":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":["string","null"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"TODO"},{"type":"string","const":"IN_PROGRESS"},{"type":"string","const":"REVIEW"},{"type":"string","const":"DONE"}]},"startDate":{"type":["string","null"]},"dueDate":{"type":["string","null"]},"currency":{"type":"string"},"notes":{"type":["string","null"]},"assignedToId":{"type":["string","null"]},"createdById":{"type":"string"},"totalTimeSpent":{"type":"number"},"isTimerRunning":{"type":"boolean"},"lastTimerStartedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"invoiceId":{"type":["string","null"]},"hourlyRate":{"type":["string","null"]}},"required":["id","organizationId","projectId","title","description","status","startDate","dueDate","currency","notes","assignedToId","createdById","totalTimeSpent","isTimerRunning","lastTimerStartedAt","createdAt","updatedAt","invoiceId","hourlyRate"],"additionalProperties":false}},"required":["success","task"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"delete":{"operationId":"deleteTask","summary":"Delete a task","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tasks/bulk-delete":{"post":{"operationId":"bulkDeleteTasks","summary":"Delete multiple tasks","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1}}},"required":["ids"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deletedCount":{"type":"number"}},"required":["success","deletedCount"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tasks/{id}/status":{"patch":{"operationId":"updateTaskStatus","summary":"Update task status","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["TODO","IN_PROGRESS","REVIEW","DONE"]}},"required":["status"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"task":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":["string","null"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"TODO"},{"type":"string","const":"IN_PROGRESS"},{"type":"string","const":"REVIEW"},{"type":"string","const":"DONE"}]},"startDate":{"type":["string","null"]},"dueDate":{"type":["string","null"]},"currency":{"type":"string"},"notes":{"type":["string","null"]},"assignedToId":{"type":["string","null"]},"createdById":{"type":"string"},"totalTimeSpent":{"type":"number"},"isTimerRunning":{"type":"boolean"},"lastTimerStartedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"invoiceId":{"type":["string","null"]},"hourlyRate":{"type":["string","null"]}},"required":["id","organizationId","projectId","title","description","status","startDate","dueDate","currency","notes","assignedToId","createdById","totalTimeSpent","isTimerRunning","lastTimerStartedAt","createdAt","updatedAt","invoiceId","hourlyRate"],"additionalProperties":false}},"required":["success","task"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tasks/{taskId}/timer":{"post":{"operationId":"controlTaskTimer","summary":"Start/stop/pause or adjust a task timer","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"taskId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["START","STOP","PAUSE","RESUME","MANUAL_ADD","MANUAL_REMOVE"]},"manualSeconds":{"type":"integer","minimum":0,"maximum":9007199254740991},"note":{"type":"string","maxLength":500}},"required":["action"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"success":{"type":"boolean"},"task":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":["string","null"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"TODO"},{"type":"string","const":"IN_PROGRESS"},{"type":"string","const":"REVIEW"},{"type":"string","const":"DONE"}]},"startDate":{"type":["string","null"]},"dueDate":{"type":["string","null"]},"currency":{"type":"string"},"notes":{"type":["string","null"]},"assignedToId":{"type":["string","null"]},"createdById":{"type":"string"},"totalTimeSpent":{"type":"number"},"isTimerRunning":{"type":"boolean"},"lastTimerStartedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"invoiceId":{"type":["string","null"]},"hourlyRate":{"type":["string","null"]}},"required":["id","organizationId","projectId","title","description","status","startDate","dueDate","currency","notes","assignedToId","createdById","totalTimeSpent","isTimerRunning","lastTimerStartedAt","createdAt","updatedAt","invoiceId","hourlyRate"],"additionalProperties":false},"message":{"type":"string"},"elapsedSeconds":{"not":{}}},"required":["success","task","message"],"additionalProperties":false},{"type":"object","properties":{"success":{"type":"boolean"},"task":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":["string","null"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"TODO"},{"type":"string","const":"IN_PROGRESS"},{"type":"string","const":"REVIEW"},{"type":"string","const":"DONE"}]},"startDate":{"type":["string","null"]},"dueDate":{"type":["string","null"]},"currency":{"type":"string"},"notes":{"type":["string","null"]},"assignedToId":{"type":["string","null"]},"createdById":{"type":"string"},"totalTimeSpent":{"type":"number"},"isTimerRunning":{"type":"boolean"},"lastTimerStartedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"invoiceId":{"type":["string","null"]},"hourlyRate":{"type":["string","null"]}},"required":["id","organizationId","projectId","title","description","status","startDate","dueDate","currency","notes","assignedToId","createdById","totalTimeSpent","isTimerRunning","lastTimerStartedAt","createdAt","updatedAt","invoiceId","hourlyRate"],"additionalProperties":false},"elapsedSeconds":{"type":"number"},"message":{"type":"string"}},"required":["success","task","elapsedSeconds","message"],"additionalProperties":false}]}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tasks/{taskId}/timer-history":{"get":{"operationId":"getTaskTimerHistory","summary":"Get task timer history","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"taskId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"sessions":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"id":{"type":"string"},"taskId":{"type":"string"},"userId":{"type":"string"},"action":{"anyOf":[{"type":"string","const":"START"},{"type":"string","const":"STOP"},{"type":"string","const":"PAUSE"},{"type":"string","const":"RESUME"},{"type":"string","const":"MANUAL_ADD"},{"type":"string","const":"MANUAL_REMOVE"}]},"durationSeconds":{"type":["number","null"]},"note":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["user","id","taskId","userId","action","durationSeconds","note","createdAt"],"additionalProperties":false}},"totalTimeSpent":{"type":"number"},"isTimerRunning":{"type":"boolean"}},"required":["sessions","totalTimeSpent","isTimerRunning"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tasks/{taskId}/assets":{"post":{"operationId":"uploadTaskAsset","summary":"Upload a task asset (base64)","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"taskId","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"asset":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":255},"fileData":{"type":"string","minLength":1},"contentType":{"type":"string","minLength":1}},"required":["fileName","fileData","contentType"]}},"required":["asset"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"asset":{"type":"object","properties":{"id":{"type":"string"},"taskId":{"type":"string"},"organizationId":{"type":"string"},"fileName":{"type":"string"},"s3Key":{"type":"string"},"s3Url":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"string"},"uploadedById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","taskId","organizationId","fileName","s3Key","s3Url","contentType","size","uploadedById","createdAt","updatedAt"],"additionalProperties":false}},"required":["success","asset"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tasks/assets/{assetId}":{"delete":{"operationId":"deleteTaskAsset","summary":"Delete a task asset","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"assetId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tasks/assets/{assetId}/download-url":{"post":{"operationId":"getTaskAssetDownloadUrl","summary":"Get a signed download URL for a task asset","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"assetId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tasks/{taskId}/assign":{"post":{"operationId":"assignTask","summary":"Assign a task to an employee","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"taskId","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"employeeId":{"type":"string"}},"required":["employeeId"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"task":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":["string","null"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"TODO"},{"type":"string","const":"IN_PROGRESS"},{"type":"string","const":"REVIEW"},{"type":"string","const":"DONE"}]},"startDate":{"type":["string","null"]},"dueDate":{"type":["string","null"]},"currency":{"type":"string"},"notes":{"type":["string","null"]},"assignedToId":{"type":["string","null"]},"createdById":{"type":"string"},"totalTimeSpent":{"type":"number"},"isTimerRunning":{"type":"boolean"},"lastTimerStartedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"invoiceId":{"type":["string","null"]},"hourlyRate":{"type":["string","null"]}},"required":["id","organizationId","projectId","title","description","status","startDate","dueDate","currency","notes","assignedToId","createdById","totalTimeSpent","isTimerRunning","lastTimerStartedAt","createdAt","updatedAt","invoiceId","hourlyRate"],"additionalProperties":false}},"required":["success","task"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tasks/{taskId}/unassign":{"post":{"operationId":"unassignTask","summary":"Unassign a task","tags":["Tasks"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"taskId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"task":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":["string","null"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"TODO"},{"type":"string","const":"IN_PROGRESS"},{"type":"string","const":"REVIEW"},{"type":"string","const":"DONE"}]},"startDate":{"type":["string","null"]},"dueDate":{"type":["string","null"]},"currency":{"type":"string"},"notes":{"type":["string","null"]},"assignedToId":{"type":["string","null"]},"createdById":{"type":"string"},"totalTimeSpent":{"type":"number"},"isTimerRunning":{"type":"boolean"},"lastTimerStartedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"invoiceId":{"type":["string","null"]},"hourlyRate":{"type":["string","null"]}},"required":["id","organizationId","projectId","title","description","status","startDate","dueDate","currency","notes","assignedToId","createdById","totalTimeSpent","isTimerRunning","lastTimerStartedAt","createdAt","updatedAt","invoiceId","hourlyRate"],"additionalProperties":false}},"required":["success","task"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects":{"get":{"operationId":"listProjects","summary":"List projects","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"query","name":"page","schema":{"default":1,"type":"number","minimum":1}},{"in":"query","name":"pageSize","schema":{"default":25,"type":"number","minimum":1,"maximum":100}},{"in":"query","name":"search","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"default":"all","anyOf":[{"type":"string","enum":["ACTIVE","PENDING","COMPLETED"]},{"type":"string","const":"all"}]}},{"in":"query","name":"customerId","schema":{"type":"string"}},{"in":"query","name":"assignedToId","schema":{"type":"string"}},{"in":"query","name":"dateFrom","schema":{"type":"string"}},{"in":"query","name":"dateTo","schema":{"type":"string"}},{"in":"query","name":"sortBy","schema":{"default":"createdAt","type":"string","enum":["name","status","startDate","endDate","budget","createdAt"]}},{"in":"query","name":"sortOrder","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"projects":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"ACTIVE"},{"type":"string","const":"PENDING"},{"type":"string","const":"COMPLETED"}]},"customerId":{"type":["string","null"]},"budget":{"type":["string","null"]},"currency":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":["string","null"]},"createdById":{"type":"string"},"assignedToId":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"taskCount":{"type":"number"},"_count":{"type":"object","properties":{"tasks":{"type":"number"}},"required":["tasks"],"additionalProperties":false},"assignedTo":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]}},"required":["id","organizationId","name","description","status","customerId","budget","currency","startDate","endDate","createdById","assignedToId","createdAt","updatedAt","taskCount","_count","assignedTo","customer"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"currentPage":{"type":"number"},"pageSize":{"type":"number"},"totalCount":{"type":"number"},"totalPages":{"type":"number"},"hasNextPage":{"type":"boolean"},"hasPreviousPage":{"type":"boolean"}},"required":["currentPage","pageSize","totalCount","totalPages","hasNextPage","hasPreviousPage"],"additionalProperties":false}},"required":["projects","pagination"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"post":{"operationId":"createProject","summary":"Create a project","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"description":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]},"status":{"default":"ACTIVE","type":"string","enum":["ACTIVE","PENDING","COMPLETED"]},"customerId":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]},"budget":{"type":"number","minimum":0},"currency":{"default":"USD","type":"string","minLength":3,"maxLength":3},"startDate":{"type":"string"},"endDate":{"type":"string"},"assignedToId":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]}},"required":["name"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"project":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"ACTIVE"},{"type":"string","const":"PENDING"},{"type":"string","const":"COMPLETED"}]},"customerId":{"type":["string","null"]},"budget":{"type":["string","null"]},"currency":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":["string","null"]},"createdById":{"type":"string"},"assignedToId":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","status","customerId","budget","currency","startDate","endDate","createdById","assignedToId","createdAt","updatedAt"],"additionalProperties":false}},"required":["success","project"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/{id}":{"get":{"operationId":"getProject","summary":"Get a project by ID","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"ACTIVE"},{"type":"string","const":"PENDING"},{"type":"string","const":"COMPLETED"}]},"customerId":{"type":["string","null"]},"budget":{"type":["string","null"]},"currency":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":["string","null"]},"createdById":{"type":"string"},"assignedToId":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"shares":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"token":{"type":"string"},"isActive":{"type":"boolean"},"expiresAt":{"type":["string","null"]},"maxViews":{"type":["number","null"]},"currentViews":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"lastViewAt":{"type":["string","null"]},"hasPassword":{"type":"boolean"}},"required":["id","projectId","token","isActive","expiresAt","maxViews","currentViews","createdById","createdAt","lastViewAt","hasPassword"],"additionalProperties":false}},"assignedTo":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"position":{"type":["string","null"]}},"required":["id","name","position"],"additionalProperties":false},{"type":"null"}]},"createdBy":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"identifier":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"address":{"type":["string","null"]},"zipCode":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"description":{"type":["string","null"]},"timezone":{"type":"string"},"country":{"type":["string","null"]},"taxId":{"type":["string","null"]},"website":{"type":["string","null"]}},"required":["id","organizationId","name","identifier","email","phone","address","zipCode","createdAt","updatedAt","description","timezone","country","taxId","website"],"additionalProperties":false},{"type":"null"}]},"estimates":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"number"},"currency":{"type":"string"},"estimateNumber":{"type":"string"},"id":{"type":"string"},"issuedDate":{"type":"string"},"status":{"anyOf":[{"type":"string","const":"DRAFT"},{"type":"string","const":"SENT"},{"type":"string","const":"ACCEPTED"},{"type":"string","const":"DECLINED"},{"type":"string","const":"EXPIRED"},{"type":"string","const":"CONVERTED"}]}},"required":["amount","currency","estimateNumber","id","issuedDate","status"],"additionalProperties":false}},"expenses":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string"},"category":{"anyOf":[{"type":"string","const":"SOFTWARE"},{"type":"string","const":"OFFICE"},{"type":"string","const":"TRAVEL"},{"type":"string","const":"MEALS"},{"type":"string","const":"MARKETING"},{"type":"string","const":"EQUIPMENT"},{"type":"string","const":"CONTRACTORS"},{"type":"string","const":"TAXES_FEES"},{"type":"string","const":"OTHER"}]},"currency":{"type":"string"},"date":{"type":"string"},"id":{"type":"string"},"title":{"type":"string"}},"required":["amount","category","currency","date","id","title"],"additionalProperties":false}},"invoices":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"number"},"currency":{"type":"string"},"id":{"type":"string"},"invoiceNumber":{"type":"string"},"issuedDate":{"type":"string"},"status":{"anyOf":[{"type":"string","const":"DRAFT"},{"type":"string","const":"SENT"},{"type":"string","const":"PAID"},{"type":"string","const":"OVERDUE"},{"type":"string","const":"CANCELLED"}]}},"required":["amount","currency","id","invoiceNumber","issuedDate","status"],"additionalProperties":false}},"tasks":{"type":"array","items":{"type":"object","properties":{"assignedTo":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":["string","null"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"TODO"},{"type":"string","const":"IN_PROGRESS"},{"type":"string","const":"REVIEW"},{"type":"string","const":"DONE"}]},"startDate":{"type":["string","null"]},"dueDate":{"type":["string","null"]},"currency":{"type":"string"},"notes":{"type":["string","null"]},"assignedToId":{"type":["string","null"]},"createdById":{"type":"string"},"totalTimeSpent":{"type":"number"},"isTimerRunning":{"type":"boolean"},"lastTimerStartedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"invoiceId":{"type":["string","null"]},"hourlyRate":{"type":["string","null"]}},"required":["assignedTo","id","organizationId","projectId","title","description","status","startDate","dueDate","currency","notes","assignedToId","createdById","totalTimeSpent","isTimerRunning","lastTimerStartedAt","createdAt","updatedAt","invoiceId","hourlyRate"],"additionalProperties":false}}},"required":["id","organizationId","name","description","status","customerId","budget","currency","startDate","endDate","createdById","assignedToId","createdAt","updatedAt","shares","assignedTo","createdBy","customer","estimates","expenses","invoices","tasks"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"patch":{"operationId":"updateProject","summary":"Update a project","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"description":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]},"status":{"type":"string","enum":["ACTIVE","PENDING","COMPLETED"]},"customerId":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]},"budget":{"type":"number","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"startDate":{"type":"string"},"endDate":{"type":"string"},"assignedToId":{"anyOf":[{"type":"string"},{"type":"string","const":""},{"type":"null"}]}}}},"required":["data"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"project":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"ACTIVE"},{"type":"string","const":"PENDING"},{"type":"string","const":"COMPLETED"}]},"customerId":{"type":["string","null"]},"budget":{"type":["string","null"]},"currency":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":["string","null"]},"createdById":{"type":"string"},"assignedToId":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","status","customerId","budget","currency","startDate","endDate","createdById","assignedToId","createdAt","updatedAt"],"additionalProperties":false}},"required":["success","project"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"delete":{"operationId":"deleteProject","summary":"Delete a project","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/bulk-delete":{"post":{"operationId":"bulkDeleteProjects","summary":"Delete multiple projects","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1}}},"required":["ids"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deletedCount":{"type":"number"}},"required":["success","deletedCount"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/{id}/status":{"patch":{"operationId":"updateProjectStatus","summary":"Update project status","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ACTIVE","PENDING","COMPLETED"]}},"required":["status"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"project":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"ACTIVE"},{"type":"string","const":"PENDING"},{"type":"string","const":"COMPLETED"}]},"customerId":{"type":["string","null"]},"budget":{"type":["string","null"]},"currency":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":["string","null"]},"createdById":{"type":"string"},"assignedToId":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","status","customerId","budget","currency","startDate","endDate","createdById","assignedToId","createdAt","updatedAt"],"additionalProperties":false}},"required":["success","project"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/{projectId}/shares":{"post":{"operationId":"createProjectShare","summary":"Create a public project share link","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expiresAt":{"type":"string"},"maxViews":{"type":"integer","minimum":1,"maximum":9007199254740991},"password":{"type":"string","minLength":1}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"shareUrl":{"type":"string"},"expiresAt":{"type":["string","null"]},"maxViews":{"type":["number","null"]}},"required":["token","shareUrl","expiresAt","maxViews"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"get":{"operationId":"listProjectShares","summary":"List active share links for a project","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"projectId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"token":{"type":"string"},"isActive":{"type":"boolean"},"expiresAt":{"type":["string","null"]},"maxViews":{"type":["number","null"]},"currentViews":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"lastViewAt":{"type":["string","null"]},"shareUrl":{"type":"string"},"password":{"not":{}},"hasPassword":{"type":"boolean"}},"required":["id","projectId","token","isActive","expiresAt","maxViews","currentViews","createdById","createdAt","lastViewAt","shareUrl","password","hasPassword"],"additionalProperties":false}}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/shares/{shareId}":{"delete":{"operationId":"revokeProjectShare","summary":"Revoke a project share link","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"shareId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/shares/{token}/validate":{"get":{"operationId":"validateProjectShareToken","summary":"Validate a public project share token","tags":["Projects"],"parameters":[{"in":"path","name":"token","schema":{"type":"string","minLength":1},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"name":{"not":{}},"id":{"not":{}},"currency":{"not":{}},"description":{"not":{}},"status":{"not":{}},"customerName":{"not":{}},"maxViews":{"not":{}},"currentViews":{"not":{}},"expiresAt":{"not":{}},"showsBranding":{"not":{}},"isPasswordProtected":{"type":"boolean"},"budget":{"not":{}},"startDate":{"not":{}},"endDate":{"not":{}},"tasks":{"not":{}},"organization":{"not":{}}},"required":["isPasswordProtected"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"ACTIVE"},{"type":"string","const":"PENDING"},{"type":"string","const":"COMPLETED"}]},"budget":{"type":["string","null"]},"currency":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":["string","null"]},"customerName":{"type":"string"},"tasks":{"type":"array","items":{"type":"object","properties":{"assignedTo":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":false},{"type":"null"}]},"id":{"type":"string"},"isTimerRunning":{"type":"boolean"},"lastTimerStartedAt":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"TODO"},{"type":"string","const":"IN_PROGRESS"},{"type":"string","const":"REVIEW"},{"type":"string","const":"DONE"}]},"title":{"type":"string"},"totalTimeSpent":{"type":"number"}},"required":["assignedTo","id","isTimerRunning","lastTimerStartedAt","status","title","totalTimeSpent"],"additionalProperties":false}},"organization":{"type":"string"},"showsBranding":{"type":"boolean"},"isPasswordProtected":{"type":"boolean"},"maxViews":{"type":["number","null"]},"currentViews":{"type":"number"},"expiresAt":{"type":["string","null"]}},"required":["id","name","description","status","budget","currency","startDate","endDate","tasks","organization","showsBranding","isPasswordProtected","maxViews","currentViews","expiresAt"],"additionalProperties":false}]}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/shares/{token}/validate-password":{"post":{"operationId":"validateProjectSharePassword","summary":"Validate a password-protected project share","tags":["Projects"],"parameters":[{"in":"path","name":"token","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string"}},"required":["password"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"ACTIVE"},{"type":"string","const":"PENDING"},{"type":"string","const":"COMPLETED"}]},"budget":{"type":["string","null"]},"currency":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":["string","null"]},"customerName":{"type":"string"},"tasks":{"type":"array","items":{"type":"object","properties":{"assignedTo":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":false},{"type":"null"}]},"id":{"type":"string"},"isTimerRunning":{"type":"boolean"},"lastTimerStartedAt":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","const":"TODO"},{"type":"string","const":"IN_PROGRESS"},{"type":"string","const":"REVIEW"},{"type":"string","const":"DONE"}]},"title":{"type":"string"},"totalTimeSpent":{"type":"number"}},"required":["assignedTo","id","isTimerRunning","lastTimerStartedAt","status","title","totalTimeSpent"],"additionalProperties":false}},"organization":{"type":"string"},"showsBranding":{"type":"boolean"},"isPasswordProtected":{"type":"boolean"},"maxViews":{"type":["number","null"]},"currentViews":{"type":"number"},"expiresAt":{"type":["string","null"]}},"required":["id","name","description","status","budget","currency","startDate","endDate","tasks","organization","showsBranding","isPasswordProtected","maxViews","currentViews","expiresAt"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/{projectId}/invoices":{"post":{"operationId":"linkProjectInvoice","summary":"Link an invoice to a project","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"projectId","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"invoiceId":{"type":"string"}},"required":["invoiceId"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/invoices/{invoiceId}":{"delete":{"operationId":"unlinkProjectInvoice","summary":"Unlink an invoice from its project","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"invoiceId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/{projectId}/estimates":{"post":{"operationId":"linkProjectEstimate","summary":"Link an estimate to a project","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"projectId","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"estimateId":{"type":"string"}},"required":["estimateId"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/estimates/{estimateId}":{"delete":{"operationId":"unlinkProjectEstimate","summary":"Unlink an estimate from its project","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"estimateId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/{projectId}/expenses":{"post":{"operationId":"linkProjectExpense","summary":"Link an expense to a project","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"projectId","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expenseId":{"type":"string"}},"required":["expenseId"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/expenses/{expenseId}":{"delete":{"operationId":"unlinkProjectExpense","summary":"Unlink an expense from its project","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"expenseId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/organization":{"get":{"operationId":"getOrganization","summary":"Get the current user's organization and membership","tags":["Organization"],"security":[{"Authorization":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"myOrganization":{"type":"object","properties":{"invoiceSettings":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"invoiceNumberStrategy":{"type":"string"},"invoiceNumberPrefix":{"type":"string"},"invoiceNumberPattern":{"type":["string","null"]},"invoiceNumberLength":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"defaultEndMessage":{"type":["string","null"]},"defaultTermsOfPayment":{"type":["string","null"]},"defaultSignature":{"type":["string","null"]},"defaultSignatureKey":{"type":["string","null"]},"defaultFooter":{"type":["string","null"]},"defaultDateFormat":{"type":"string"},"defaultTemplate":{"type":"string"},"defaultLanguage":{"type":"string"},"defaultEstimateValidityDays":{"type":"number"},"estimateNumberLength":{"type":"number"},"estimateNumberPrefix":{"type":"string"},"estimateNumberStrategy":{"type":"string"},"defaultCurrencyFormat":{"type":"string"}},"required":["id","organizationId","invoiceNumberStrategy","invoiceNumberPrefix","invoiceNumberPattern","invoiceNumberLength","createdAt","updatedAt","defaultEndMessage","defaultTermsOfPayment","defaultSignature","defaultSignatureKey","defaultFooter","defaultDateFormat","defaultTemplate","defaultLanguage","defaultEstimateValidityDays","estimateNumberLength","estimateNumberPrefix","estimateNumberStrategy","defaultCurrencyFormat"],"additionalProperties":false},{"type":"null"}]},"id":{"type":"string"},"ownerId":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companyAddress":{"type":["string","null"]},"companyEmail":{"type":["string","null"]},"companyLogo":{"type":["string","null"]},"companyName":{"type":["string","null"]},"companyPhone":{"type":["string","null"]},"timezone":{"type":"string"},"companyLogoKey":{"type":["string","null"]},"defaultCurrency":{"type":"string"},"businessType":{"type":["string","null"]},"calendarWeekStartsOn":{"type":"number"}},"required":["invoiceSettings","id","ownerId","createdAt","updatedAt","companyAddress","companyEmail","companyLogo","companyName","companyPhone","timezone","companyLogoKey","defaultCurrency","businessType","calendarWeekStartsOn"],"additionalProperties":false},"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"email":{"type":"string"},"emailVerified":{"type":["string","null"]},"image":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"emailVerifiedBool":{"type":"boolean"},"lifecycleEmailOptOutAt":{"type":["string","null"]},"banned":{"type":"boolean"},"bannedAt":{"type":["string","null"]},"banReason":{"type":["string","null"]}},"required":["id","name","email","emailVerified","image","createdAt","updatedAt","emailVerifiedBool","lifecycleEmailOptOutAt","banned","bannedAt","banReason"],"additionalProperties":false},"me":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"organizationId":{"type":"string"},"role":{"anyOf":[{"type":"string","const":"ADMIN"},{"type":"string","const":"MEMBER"},{"type":"string","const":"GUEST"}]},"createdAt":{"type":"string"}},"required":["id","userId","organizationId","role","createdAt"],"additionalProperties":false}},"required":["myOrganization","user","me"],"additionalProperties":false},{"type":"null"}]}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/subscription":{"get":{"operationId":"getSubscription","summary":"Get the current organization's subscription and usage","tags":["Subscription"],"security":[{"Authorization":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"subscription":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"polarSubscriptionId":{"type":["string","null"]},"polarCustomerId":{"type":["string","null"]},"planType":{"anyOf":[{"type":"string","const":"TRIAL"},{"type":"string","const":"PRO"},{"type":"string","const":"ENTERPRISE"},{"type":"string","const":"SOLO"}]},"status":{"anyOf":[{"type":"string","const":"ACTIVE"},{"type":"string","const":"EXPIRED"},{"type":"string","const":"TRIALING"},{"type":"string","const":"PAST_DUE"},{"type":"string","const":"CANCELED"},{"type":"string","const":"UNPAID"},{"type":"string","const":"INCOMPLETE"}]},"currentPeriodStart":{"type":["string","null"]},"currentPeriodEnd":{"type":["string","null"]},"trialStart":{"type":["string","null"]},"trialEnd":{"type":["string","null"]},"cancelAtPeriodEnd":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"billingCycle":{"anyOf":[{"type":"string","const":"TRIAL"},{"type":"string","const":"MONTHLY"},{"type":"string","const":"YEARLY"}]},"amount":{"type":"number"},"usagePeriodEnd":{"type":["string","null"]},"usagePeriodStart":{"type":["string","null"]},"appleOriginalTransactionId":{"type":["string","null"]},"appleProductId":{"type":["string","null"]},"revenuecatCustomerId":{"type":["string","null"]},"source":{"anyOf":[{"type":"string","const":"POLAR"},{"type":"string","const":"APPLE"}]}},"required":["id","organizationId","polarSubscriptionId","polarCustomerId","planType","status","currentPeriodStart","currentPeriodEnd","trialStart","trialEnd","cancelAtPeriodEnd","createdAt","updatedAt","billingCycle","amount","usagePeriodEnd","usagePeriodStart","appleOriginalTransactionId","appleProductId","revenuecatCustomerId","source"],"additionalProperties":false},"usage":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"subscriptionId":{"type":"string"},"metricType":{"anyOf":[{"type":"string","const":"API_CALLS"},{"type":"string","const":"STORAGE_GB"},{"type":"string","const":"MEMBERS"},{"type":"string","const":"INVOICES_GENERATED"},{"type":"string","const":"FILE_UPLOAD_SIZE_MB"},{"type":"string","const":"PRODUCTS_COUNT"},{"type":"string","const":"CATEGORIES_COUNT"},{"type":"string","const":"CUSTOMERS_COUNT"},{"type":"string","const":"EMAILS_SENT"},{"type":"string","const":"ESTIMATES_GENERATED"},{"type":"string","const":"PROJECTS_COUNT"},{"type":"string","const":"TASKS_COUNT"},{"type":"string","const":"AI_CREDITS"}]},"value":{"type":"number"},"period":{"type":"string"}},"required":["id","organizationId","createdAt","updatedAt","subscriptionId","metricType","value","period"],"additionalProperties":false}},"limits":{"type":"object","properties":{"API_CALLS":{"type":"number"},"STORAGE_GB":{"type":"number"},"MEMBERS":{"type":"number"},"INVOICES_GENERATED":{"type":"number"},"FILE_UPLOAD_SIZE_MB":{"type":"number"},"PRODUCTS_COUNT":{"type":"number"},"CATEGORIES_COUNT":{"type":"number"},"CUSTOMERS_COUNT":{"type":"number"},"PROJECTS_COUNT":{"type":"number"},"TASKS_COUNT":{"type":"number"},"EMAILS_SENT":{"type":"number"},"ESTIMATES_GENERATED":{"type":"number"},"AI_CREDITS":{"type":"number"}},"required":["API_CALLS","STORAGE_GB","MEMBERS","INVOICES_GENERATED","FILE_UPLOAD_SIZE_MB","PRODUCTS_COUNT","CATEGORIES_COUNT","CUSTOMERS_COUNT","PROJECTS_COUNT","TASKS_COUNT","EMAILS_SENT","ESTIMATES_GENERATED","AI_CREDITS"],"additionalProperties":false},"pricing":{"type":"object","properties":{"price":{"type":"number"},"period":{"type":"string"},"billingCycle":{"anyOf":[{"type":"string","const":"trial"},{"type":"string","const":"monthly"},{"type":"string","const":"yearly"}]},"annualPrice":{"type":"number"},"savings":{"type":"string"}},"required":["price","period","billingCycle"],"additionalProperties":false},"trialDaysRemaining":{"type":"number"},"usagePercentages":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"canUpgrade":{"type":"boolean"},"checkoutBlock":{"anyOf":[{"type":"object","properties":{"reason":{"anyOf":[{"type":"string","const":"APPLE_BILLED"},{"type":"string","const":"PAYMENT_ISSUE"}]},"message":{"type":"string"}},"required":["reason","message"],"additionalProperties":false},{"type":"null"}]},"needsUpgrade":{"type":"boolean"},"hasNoAccess":{"type":"boolean"},"hasLimitedAccess":{"type":"boolean"},"isTrialExpired":{"type":"boolean"},"isUnpaid":{"type":"boolean"},"isIncomplete":{"type":"boolean"},"isPastDue":{"type":"boolean"},"isFreeTier":{"type":"boolean"},"showsBranding":{"type":"boolean"}},"required":["subscription","usage","limits","pricing","trialDaysRemaining","usagePercentages","canUpgrade","checkoutBlock","needsUpgrade","hasNoAccess","hasLimitedAccess","isTrialExpired","isUnpaid","isIncomplete","isPastDue","isFreeTier","showsBranding"],"additionalProperties":false}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/subscription/sync-revenuecat":{"post":{"operationId":"syncRevenueCatSubscription","summary":"Sync the Apple In-App Purchase entitlement from RevenueCat","tags":["Subscription"],"security":[{"Authorization":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"}},"required":["active"],"additionalProperties":false}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}}},"components":{"schemas":{"error.BAD_REQUEST":{"type":"object","properties":{"message":{"type":"string","description":"The error message","example":"Invalid input data"},"code":{"type":"string","description":"The error code","example":"BAD_REQUEST"},"issues":{"description":"An array of issues that were responsible for the error","example":[],"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false,"title":"Invalid input data error (400)","description":"The error information","example":{"code":"BAD_REQUEST","message":"Invalid input data","issues":[]}},"error.UNAUTHORIZED":{"type":"object","properties":{"message":{"type":"string","description":"The error message","example":"Authorization not provided"},"code":{"type":"string","description":"The error code","example":"UNAUTHORIZED"},"issues":{"description":"An array of issues that were responsible for the error","example":[],"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false,"title":"Authorization not provided error (401)","description":"The error information","example":{"code":"UNAUTHORIZED","message":"Authorization not provided","issues":[]}},"error.FORBIDDEN":{"type":"object","properties":{"message":{"type":"string","description":"The error message","example":"Insufficient access"},"code":{"type":"string","description":"The error code","example":"FORBIDDEN"},"issues":{"description":"An array of issues that were responsible for the error","example":[],"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false,"title":"Insufficient access error (403)","description":"The error information","example":{"code":"FORBIDDEN","message":"Insufficient access","issues":[]}},"error.NOT_FOUND":{"type":"object","properties":{"message":{"type":"string","description":"The error message","example":"Not found"},"code":{"type":"string","description":"The error code","example":"NOT_FOUND"},"issues":{"description":"An array of issues that were responsible for the error","example":[],"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false,"title":"Not found error (404)","description":"The error information","example":{"code":"NOT_FOUND","message":"Not found","issues":[]}},"error.INTERNAL_SERVER_ERROR":{"type":"object","properties":{"message":{"type":"string","description":"The error message","example":"Internal server error"},"code":{"type":"string","description":"The error code","example":"INTERNAL_SERVER_ERROR"},"issues":{"description":"An array of issues that were responsible for the error","example":[],"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false,"title":"Internal server error error (500)","description":"The error information","example":{"code":"INTERNAL_SERVER_ERROR","message":"Internal server error","issues":[]}}},"securitySchemes":{"Authorization":{"type":"http","scheme":"bearer"}}}}