{"openapi":"3.1.0","info":{"title":"Store Layer API","description":"Project-based loyalty engine API.","version":"2.0.0"},"servers":[{"url":"/","description":"Current environment"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"JWT token or project API key"}},"schemas":{"ResourceFieldDefinition":{"type":"object","properties":{"key":{"type":"string","minLength":1},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["string","number","boolean","object","array"]},"description":{"type":"string"},"enumValues":{"type":"array","items":{"type":"string"}},"children":{"type":"array","items":{"$ref":"#/components/schemas/ResourceFieldDefinition"}}},"required":["key","label","type"]},"FilterGroup":{"type":"object","properties":{"AND":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/FilterCondition"},{"$ref":"#/components/schemas/FilterGroup"}]}},"OR":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/FilterCondition"},{"$ref":"#/components/schemas/FilterGroup"}]}}}},"FilterCondition":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","like","startsWith","endsWith","contains","in","notIn","isNull","isNotNull"]},"value":{}},"required":["field","op"]}}},"paths":{"/health":{"get":{"operationId":"getHealth","tags":["Health"],"summary":"Health check","responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"timestamp":{"type":"string"}}}}}}}}},"/auth/login":{"post":{"operationId":"postAuthLogin","tags":["Auth"],"summary":"Login to an existing account","responses":{"200":{"description":"Login successful","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"401":{"description":"Invalid credentials","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"password":{"type":"string","minLength":1}},"required":["email","password"]}}}}}},"/auth/register":{"post":{"operationId":"postAuthRegister","tags":["Auth"],"summary":"Register a new account","responses":{"201":{"description":"Account created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"409":{"description":"Email already exists","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"password":{"type":"string","minLength":8},"name":{"type":"string","minLength":1}},"required":["email","password","name"]}}}}}},"/auth/invite-info":{"get":{"operationId":"getAuthInviteInfo","tags":["Auth"],"summary":"Get invitation details by token (public)","responses":{"200":{"description":"Invitation info","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Invitation not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"query","name":"token","schema":{"type":"string","minLength":1},"required":true}]}},"/auth/accept-invite":{"post":{"operationId":"postAuthAcceptInvite","tags":["Auth"],"summary":"Accept an invitation (public)","responses":{"200":{"description":"Invitation accepted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Invitation not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"password":{"type":"string","minLength":1}},"required":["token"]}}}}}},"/ingest/events":{"post":{"operationId":"postIngestEvents","tags":["Events"],"summary":"Ingest an event from an external system","responses":{"201":{"description":"Event accepted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","minLength":1},"userId":{"type":"string"},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["type","payload"]}}}}}},"/public/support/{projectId}/tickets":{"post":{"operationId":"postPublicSupportByProjectIdTickets","tags":["Support"],"summary":"Submit a support ticket (public)","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"category":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"images":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"url":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"size":{"type":"number","minimum":0},"mimeType":{"type":"string","minLength":1}},"required":["url","name","size","mimeType"]}},"externalUserId":{"type":"string"},"customerEmail":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"customerName":{"type":"string"},"createdBy":{"type":"string"}},"required":["title","description"]}}}}}},"/public/surveys/{projectId}/{surveyId}":{"get":{"operationId":"getPublicSurveysByProjectIdBySurveyId","tags":["Surveys"],"summary":"Get an active survey (public)","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Survey not found or not active","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"surveyId","schema":{"type":"string","minLength":1},"required":true}]}},"/public/surveys/{projectId}/{surveyId}/responses":{"post":{"operationId":"postPublicSurveysByProjectIdBySurveyIdResponses","tags":["Surveys"],"summary":"Submit a survey response (public)","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Survey not found or not active","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"surveyId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"externalUserId":{"type":"string"},"respondentEmail":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"answers":{"minItems":1,"type":"array","items":{"type":"object","properties":{"questionId":{"type":"string","minLength":1},"value":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["questionId","value"]}}},"required":["answers"]}}}}}},"/public/tools":{"get":{"operationId":"getPublicTools","tags":["Internal Tools"],"summary":"List available internal tools","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}}}}},"/public/tools/{toolName}/execute":{"post":{"operationId":"postPublicToolsByToolNameExecute","tags":["Internal Tools"],"summary":"Execute a tool (API key auth, projectId from key)","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Invalid JSON body","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Tool not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Execution error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"toolName","required":true}]}},"/assets/{projectId}/facilities/{facilityId}/icon":{"get":{"operationId":"getAssetsByProjectIdFacilitiesByFacilityIdIcon","tags":["Assets"],"summary":"Serve facility icon","responses":{},"parameters":[{"schema":{"type":"string"},"in":"path","name":"projectId","required":true},{"schema":{"type":"string"},"in":"path","name":"facilityId","required":true}]}},"/assets/{projectId}/stores/{storeId}/image":{"get":{"operationId":"getAssetsByProjectIdStoresByStoreIdImage","tags":["Assets"],"summary":"Serve store image","responses":{},"parameters":[{"schema":{"type":"string"},"in":"path","name":"projectId","required":true},{"schema":{"type":"string"},"in":"path","name":"storeId","required":true}]}},"/dev/durable-objects":{"get":{"operationId":"getDevDurableObjects","tags":["Devtools"],"summary":"List all DO types","responses":{}}},"/dev/durable-objects/{type}/{instanceId}":{"get":{"operationId":"getDevDurableObjectsByTypeByInstanceId","tags":["Devtools"],"summary":"Inspect a DO instance","responses":{},"parameters":[{"schema":{"type":"string"},"in":"path","name":"type","required":true},{"schema":{"type":"string"},"in":"path","name":"instanceId","required":true}]}},"/dev/durable-objects/{type}/{instanceId}/query":{"post":{"operationId":"postDevDurableObjectsByTypeByInstanceIdQuery","tags":["Devtools"],"summary":"Run SQL query on a DO instance","responses":{},"parameters":[{"schema":{"type":"string"},"in":"path","name":"type","required":true},{"schema":{"type":"string"},"in":"path","name":"instanceId","required":true}]}},"/dev/durable-objects/{type}/{instanceId}/kv":{"post":{"operationId":"postDevDurableObjectsByTypeByInstanceIdKv","tags":["Devtools"],"summary":"Browse KV data of a DO instance","responses":{},"parameters":[{"schema":{"type":"string"},"in":"path","name":"type","required":true},{"schema":{"type":"string"},"in":"path","name":"instanceId","required":true}]}},"/dev/d1/tables":{"get":{"operationId":"getDevD1Tables","tags":["Devtools"],"summary":"List D1 tables","responses":{}}},"/dev/d1/query":{"post":{"operationId":"postDevD1Query","tags":["Devtools"],"summary":"Run D1 query","responses":{}}},"/dev/kv/keys":{"post":{"operationId":"postDevKvKeys","tags":["Devtools"],"summary":"List KV keys","responses":{}}},"/dev/kv/get/{key}":{"get":{"operationId":"getDevKvGetByKey","tags":["Devtools"],"summary":"Get KV value","responses":{},"parameters":[{"schema":{"type":"string"},"in":"path","name":"key","required":true}]}},"/dev/projects":{"get":{"operationId":"getDevProjects","tags":["Devtools"],"summary":"List projects from D1","responses":{}}},"/dev/projects/{projectId}/external-users":{"get":{"operationId":"getDevProjectsByProjectIdExternalUsers","tags":["Devtools"],"summary":"List external users for a project","responses":{},"parameters":[{"schema":{"type":"string"},"in":"path","name":"projectId","required":true}]}},"/me":{"get":{"operationId":"getMe","tags":["Users"],"summary":"Get current user profile","responses":{"200":{"description":"Current user","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}}}}},"/users/{userId}/projects":{"get":{"operationId":"getUsersByUserIdProjects","tags":["Users"],"summary":"List user's projects","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"userId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects":{"post":{"operationId":"postProjects","tags":["Projects"],"summary":"Create a new project","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"}},"required":["name"]}}}}}},"/projects/{projectId}":{"get":{"operationId":"getProjectsByProjectId","tags":["Projects"],"summary":"Get a project by ID","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]},"patch":{"operationId":"patchProjectsByProjectId","tags":["Projects"],"summary":"Update a project","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"}}}}}}},"delete":{"operationId":"deleteProjectsByProjectId","tags":["Projects"],"summary":"Delete a project","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"400":{"description":"Confirmation mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"403":{"description":"Not authorized","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"409":{"description":"Project has active rules","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"confirm","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/invite":{"post":{"operationId":"postProjectsByProjectIdInvite","tags":["Team"],"summary":"Invite a user to the project via email","responses":{"201":{"description":"Invitation sent","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"role":{"default":"member","type":"string","enum":["admin","member"]}},"required":["email"]}}}}}},"/projects/{projectId}/invitations":{"get":{"operationId":"getProjectsByProjectIdInvitations","tags":["Team"],"summary":"List project invitations","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/invitations/{invitationId}":{"delete":{"operationId":"deleteProjectsByProjectIdInvitationsByInvitationId","tags":["Team"],"summary":"Revoke and delete an invitation","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"404":{"description":"Invitation not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"invitationId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/invitations/{invitationId}/resend":{"post":{"operationId":"postProjectsByProjectIdInvitationsByInvitationIdResend","tags":["Team"],"summary":"Resend an invitation email","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Invitation not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"invitationId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/members":{"get":{"operationId":"getProjectsByProjectIdMembers","tags":["Team"],"summary":"List project team members","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/members/{memberId}":{"patch":{"operationId":"patchProjectsByProjectIdMembersByMemberId","tags":["Team"],"summary":"Update a member's role","responses":{"200":{"description":"Role updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Cannot change owner role","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Member not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"memberId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["admin","member"]}},"required":["role"]}}}}},"delete":{"operationId":"deleteProjectsByProjectIdMembersByMemberId","tags":["Team"],"summary":"Remove a member from the project","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"400":{"description":"Cannot remove owner","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"projectId","required":true},{"schema":{"type":"string"},"in":"path","name":"memberId","required":true}]}},"/projects/{projectId}/transfer-ownership":{"post":{"operationId":"postProjectsByProjectIdTransferOwnership","tags":["Team"],"summary":"Transfer project ownership to another member","responses":{"200":{"description":"Ownership transferred","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Invalid transfer","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Member not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"memberId":{"type":"string","minLength":1}},"required":["memberId"]}}}}}},"/projects/{projectId}/users":{"post":{"operationId":"postProjectsByProjectIdUsers","tags":["External Users"],"summary":"Register an external user","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"409":{"description":"User already exists","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"firstName":{"type":"string","minLength":1},"lastName":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string"},"birthday":{"type":"string"},"gender":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["userId","firstName","lastName"]}}}}},"get":{"operationId":"getProjectsByProjectIdUsers","tags":["External Users"],"summary":"List external users","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"in":"query","name":"search","schema":{"type":"string","maxLength":200}}]}},"/projects/{projectId}/users/bulk":{"post":{"operationId":"postProjectsByProjectIdUsersBulk","tags":["External Users"],"summary":"Bulk register external users (max 1000)","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"409":{"description":"Duplicate user IDs","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"users":{"minItems":1,"maxItems":1000,"type":"array","items":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"firstName":{"type":"string","minLength":1},"lastName":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string"},"birthday":{"type":"string"},"gender":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["userId","firstName","lastName"]}}},"required":["users"]}}}}}},"/projects/{projectId}/users/{userId}":{"get":{"operationId":"getProjectsByProjectIdUsersByUserId","tags":["External Users"],"summary":"Get an external user","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"userId","schema":{"type":"string","minLength":1},"required":true}]},"patch":{"operationId":"patchProjectsByProjectIdUsersByUserId","tags":["External Users"],"summary":"Update an external user, creating it if the userId is unknown","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"userId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":"string","minLength":1},"lastName":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string"},"birthday":{"type":"string"},"gender":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdUsersByUserId","tags":["External Users"],"summary":"Remove an external user","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"userId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/users/{userId}/events":{"get":{"operationId":"getProjectsByProjectIdUsersByUserIdEvents","tags":["External Users"],"summary":"List workflows for a user","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"userId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}]}},"/projects/{projectId}/users/{userId}/wallet":{"get":{"operationId":"getProjectsByProjectIdUsersByUserIdWallet","tags":["Wallet"],"summary":"Get wallet balance","description":"Get every asset balance in a user wallet — points, stamps, coins — with lifetime earned, spent and expired totals.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"userId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/users/{userId}/wallet/earn":{"post":{"operationId":"postProjectsByProjectIdUsersByUserIdWalletEarn","tags":["Wallet"],"summary":"Earn assets into wallet","description":"Add assets to a user wallet with optional expiration and tags. Use this to award points, stamps or coins.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"userId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"assetType":{"type":"string","minLength":1},"amount":{"type":"number","exclusiveMinimum":0},"expiresAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"tags":{"type":"array","items":{"type":"string"}},"referenceId":{"type":"string"},"referenceType":{"type":"string"},"description":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["assetType","amount"]}}}}}},"/projects/{projectId}/users/{userId}/wallet/spend":{"post":{"operationId":"postProjectsByProjectIdUsersByUserIdWalletSpend","tags":["Wallet"],"summary":"Spend assets from wallet","description":"Spend assets from a user wallet using FEFO (first expiring, first out). Fails when the balance is insufficient.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"userId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"assetType":{"type":"string","minLength":1},"amount":{"type":"number","exclusiveMinimum":0},"referenceId":{"type":"string"},"referenceType":{"type":"string"},"description":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["assetType","amount"]}}}}}},"/projects/{projectId}/users/{userId}/wallet/modify":{"post":{"operationId":"postProjectsByProjectIdUsersByUserIdWalletModify","tags":["Wallet"],"summary":"Set wallet balance to an absolute amount","description":"Set an asset balance to an absolute target, recording a single adjust transaction with the delta. Increases create a new entry; decreases consume existing entries FEFO.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"userId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"assetType":{"type":"string","minLength":1},"targetAmount":{"type":"number","minimum":0},"expiresAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"tags":{"type":"array","items":{"type":"string"}},"referenceId":{"type":"string"},"referenceType":{"type":"string"},"description":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["assetType","targetAmount"]}}}}}},"/projects/{projectId}/users/{userId}/wallet/assets":{"get":{"operationId":"getProjectsByProjectIdUsersByUserIdWalletAssets","tags":["Wallet"],"summary":"List wallet assets","description":"List the active asset entries in a user wallet, optionally filtered by asset type or tag.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"userId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"in":"query","name":"assetType","schema":{"type":"string"}},{"in":"query","name":"tag","schema":{"type":"string"}}]}},"/projects/{projectId}/users/{userId}/wallet/transactions":{"get":{"operationId":"getProjectsByProjectIdUsersByUserIdWalletTransactions","tags":["Wallet"],"summary":"List wallet transactions","description":"List a user wallet transaction history, optionally filtered by transaction type and asset type.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"userId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"in":"query","name":"type","schema":{"type":"string","enum":["earn","spend","expire","adjust"]}},{"in":"query","name":"assetType","schema":{"type":"string"}}]}},"/projects/{projectId}/config":{"get":{"operationId":"getProjectsByProjectIdConfig","tags":["Project Config"],"summary":"Get project config","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]},"patch":{"operationId":"patchProjectsByProjectIdConfig","tags":["Project Config"],"summary":"Update project config","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string"},"timezone":{"type":"string"},"settings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}}}}},"/projects/{projectId}/resource-definitions":{"get":{"operationId":"getProjectsByProjectIdResourceDefinitions","tags":["Resources"],"summary":"List resource definitions","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]},"put":{"operationId":"putProjectsByProjectIdResourceDefinitions","tags":["Resources"],"summary":"Replace all resource definitions","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"definitions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-zA-Z][a-zA-Z0-9_]*$"},"name":{"type":"string","minLength":1},"kind":{"type":"string","enum":["runtime"]},"fields":{"type":"array","items":{"$ref":"#/components/schemas/ResourceFieldDefinition"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["key","name","kind","fields"]}}},"required":["definitions"]}}}}}},"/projects/{projectId}/resource-definitions/{resourceKey}/data":{"get":{"operationId":"getProjectsByProjectIdResourceDefinitionsByResourceKeyData","tags":["Resources"],"summary":"Get resource data (DEPRECATED - builtins removed)","description":"This endpoint is deprecated. Built-in resources have been removed. Use payload resources instead.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"resourceKey","schema":{"type":"string","minLength":1},"required":true}]},"put":{"operationId":"putProjectsByProjectIdResourceDefinitionsByResourceKeyData","tags":["Resources"],"summary":"Set resource data (DEPRECATED - builtins removed)","description":"This endpoint is deprecated. Built-in resources have been removed. Use payload resources instead.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"resourceKey","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"required":["data"]}}}}}},"/projects/{projectId}/resources":{"get":{"operationId":"getProjectsByProjectIdResources","tags":["Resources v2"],"summary":"List all resources (graph nodes)","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]},"post":{"operationId":"postProjectsByProjectIdResources","tags":["Resources v2"],"summary":"Create a resource","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-zA-Z][a-zA-Z0-9_]*$"},"name":{"type":"string","minLength":1},"type":{"type":"string","enum":["event","http","database","internal","payload","custom_table","code"]},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"fields":{"type":"array","items":{"$ref":"#/components/schemas/ResourceFieldDefinition"}},"dependsOn":{"type":"array","items":{"type":"string"}}},"required":["key","name","type"]}}}}}},"/projects/{projectId}/resources/resolve":{"post":{"operationId":"postProjectsByProjectIdResourcesResolve","tags":["Resources v2"],"summary":"Resolve resources with trigger context","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"triggerContext":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"resourceKeys":{"type":"array","items":{"type":"string"}}},"required":["triggerContext"]}}}}}},"/projects/{projectId}/resources/{resourceId}":{"get":{"operationId":"getProjectsByProjectIdResourcesByResourceId","tags":["Resources v2"],"summary":"Get a single resource","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"resourceId","schema":{"type":"string","minLength":1},"required":true}]},"patch":{"operationId":"patchProjectsByProjectIdResourcesByResourceId","tags":["Resources v2"],"summary":"Update a resource","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"resourceId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-zA-Z][a-zA-Z0-9_]*$"},"name":{"type":"string","minLength":1},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"fields":{"type":"array","items":{"$ref":"#/components/schemas/ResourceFieldDefinition"}},"dependsOn":{"type":"array","items":{"type":"string"}},"isActive":{"type":"boolean"}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdResourcesByResourceId","tags":["Resources v2"],"summary":"Delete a resource","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"resourceId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/resources-v2":{"get":{"operationId":"getProjectsByProjectIdResourcesV2","tags":["Resources v2"],"summary":"List all resources (graph nodes)","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]},"post":{"operationId":"postProjectsByProjectIdResourcesV2","tags":["Resources v2"],"summary":"Create a resource","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-zA-Z][a-zA-Z0-9_]*$"},"name":{"type":"string","minLength":1},"type":{"type":"string","enum":["event","http","database","internal","payload","custom_table","code"]},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"fields":{"type":"array","items":{"$ref":"#/components/schemas/ResourceFieldDefinition"}},"dependsOn":{"type":"array","items":{"type":"string"}}},"required":["key","name","type"]}}}}}},"/projects/{projectId}/resources-v2/resolve":{"post":{"operationId":"postProjectsByProjectIdResourcesV2Resolve","tags":["Resources v2"],"summary":"Resolve resources with trigger context","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"triggerContext":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"resourceKeys":{"type":"array","items":{"type":"string"}}},"required":["triggerContext"]}}}}}},"/projects/{projectId}/resources-v2/{resourceId}":{"get":{"operationId":"getProjectsByProjectIdResourcesV2ByResourceId","tags":["Resources v2"],"summary":"Get a single resource","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"resourceId","schema":{"type":"string","minLength":1},"required":true}]},"patch":{"operationId":"patchProjectsByProjectIdResourcesV2ByResourceId","tags":["Resources v2"],"summary":"Update a resource","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"resourceId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-zA-Z][a-zA-Z0-9_]*$"},"name":{"type":"string","minLength":1},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"fields":{"type":"array","items":{"$ref":"#/components/schemas/ResourceFieldDefinition"}},"dependsOn":{"type":"array","items":{"type":"string"}},"isActive":{"type":"boolean"}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdResourcesV2ByResourceId","tags":["Resources v2"],"summary":"Delete a resource","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"resourceId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/rules":{"get":{"operationId":"getProjectsByProjectIdRules","tags":["Rules"],"summary":"List project rules","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]},"post":{"operationId":"postProjectsByProjectIdRules","tags":["Rules"],"summary":"Add a rule","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"conditions":{"type":"object","properties":{"conditions":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"leftValue":{"type":"string","minLength":1},"operator":{"type":"string","enum":["equals","eq","notEquals","neq","gt","greater_than","gte","lt","less_than","lte","contains","notContains","startsWith","endsWith","exists","notExists","regex","before","after","isEmpty","isNotEmpty","hasKey","is_true","is_false","array_contains_where"]},"rightValue":{},"rightType":{"type":"string","enum":["string","number","boolean","datetime","array","object","expression"]}},"required":["leftValue","operator"]}},"combinator":{"type":"string","enum":["AND","OR"]}},"required":["conditions","combinator"]},"actions":{"anyOf":[{"minItems":1,"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"reward"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"},"expirationDate":{"type":"string"},"expiresIn":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"expiresInUnit":{"type":"string","enum":["seconds","minutes","hours","days","weeks","months","years"]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string","minLength":1}]}},"required":["assetType","amount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"redemption"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"}},"required":["assetType","amount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"modify"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"targetAmount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"},"expirationDate":{"type":"string"},"expiresIn":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"expiresInUnit":{"type":"string","enum":["seconds","minutes","hours","days","weeks","months","years"]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string","minLength":1}]}},"required":["assetType","targetAmount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"integration"},"config":{"type":"object","properties":{"integrationId":{"type":"string"},"payloadTemplate":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"string"}]},"sql":{"type":"string"},"to":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"}},"required":["integrationId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"apply_referral"},"config":{"type":"object","properties":{"code":{"type":"string","minLength":1},"refereeId":{"type":"string","minLength":1},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["code","refereeId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"complete_referral"},"config":{"type":"object","properties":{"refereeId":{"type":"string","minLength":1}},"required":["refereeId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"update_user"},"config":{"type":"object","properties":{"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"birthday":{"type":"string"},"gender":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"custom_table"},"config":{"type":"object","properties":{"operation":{"type":"string","enum":["insert","update","delete"]},"tableName":{"type":"string","minLength":1},"rowId":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["operation","tableName"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"emit_event"},"config":{"type":"object","properties":{"eventType":{"anyOf":[{"type":"string","minLength":1},{"type":"number"}]},"userId":{"type":["string","number"]},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["eventType"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"mark_code_used"},"config":{"type":"object","properties":{"code":{"anyOf":[{"type":"string","minLength":1},{"type":"number"}]},"refereeId":{"type":["string","number"]}},"required":["code"]}},"required":["type","config"]}]}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"reward"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"},"expirationDate":{"type":"string"},"expiresIn":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"expiresInUnit":{"type":"string","enum":["seconds","minutes","hours","days","weeks","months","years"]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string","minLength":1}]}},"required":["assetType","amount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"redemption"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"}},"required":["assetType","amount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"modify"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"targetAmount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"},"expirationDate":{"type":"string"},"expiresIn":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"expiresInUnit":{"type":"string","enum":["seconds","minutes","hours","days","weeks","months","years"]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string","minLength":1}]}},"required":["assetType","targetAmount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"integration"},"config":{"type":"object","properties":{"integrationId":{"type":"string"},"payloadTemplate":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"string"}]},"sql":{"type":"string"},"to":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"}},"required":["integrationId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"apply_referral"},"config":{"type":"object","properties":{"code":{"type":"string","minLength":1},"refereeId":{"type":"string","minLength":1},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["code","refereeId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"complete_referral"},"config":{"type":"object","properties":{"refereeId":{"type":"string","minLength":1}},"required":["refereeId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"update_user"},"config":{"type":"object","properties":{"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"birthday":{"type":"string"},"gender":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"custom_table"},"config":{"type":"object","properties":{"operation":{"type":"string","enum":["insert","update","delete"]},"tableName":{"type":"string","minLength":1},"rowId":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["operation","tableName"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"emit_event"},"config":{"type":"object","properties":{"eventType":{"anyOf":[{"type":"string","minLength":1},{"type":"number"}]},"userId":{"type":["string","number"]},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["eventType"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"mark_code_used"},"config":{"type":"object","properties":{"code":{"anyOf":[{"type":"string","minLength":1},{"type":"number"}]},"refereeId":{"type":["string","number"]}},"required":["code"]}},"required":["type","config"]}]}]},"resources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string","minLength":1},"type":{"type":"string","enum":["event","internal","http","database","payload","custom_table","code"]},"value":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","key","type","value"]}},"priority":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"validFrom":{"type":"string"},"validTo":{"type":"string"}},"required":["name","conditions","actions","resources"]}}}}}},"/projects/{projectId}/rules/{ruleId}":{"get":{"operationId":"getProjectsByProjectIdRulesByRuleId","tags":["Rules"],"summary":"Get a single rule","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Rule not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"ruleId","schema":{"type":"string","minLength":1},"required":true}]},"patch":{"operationId":"patchProjectsByProjectIdRulesByRuleId","tags":["Rules"],"summary":"Update a rule","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Rule not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"ruleId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"conditions":{"type":"object","properties":{"conditions":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"leftValue":{"type":"string","minLength":1},"operator":{"type":"string","enum":["equals","eq","notEquals","neq","gt","greater_than","gte","lt","less_than","lte","contains","notContains","startsWith","endsWith","exists","notExists","regex","before","after","isEmpty","isNotEmpty","hasKey","is_true","is_false","array_contains_where"]},"rightValue":{},"rightType":{"type":"string","enum":["string","number","boolean","datetime","array","object","expression"]}},"required":["leftValue","operator"]}},"combinator":{"type":"string","enum":["AND","OR"]}},"required":["conditions","combinator"]},"actions":{"anyOf":[{"minItems":1,"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"reward"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"},"expirationDate":{"type":"string"},"expiresIn":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"expiresInUnit":{"type":"string","enum":["seconds","minutes","hours","days","weeks","months","years"]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string","minLength":1}]}},"required":["assetType","amount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"redemption"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"}},"required":["assetType","amount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"modify"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"targetAmount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"},"expirationDate":{"type":"string"},"expiresIn":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"expiresInUnit":{"type":"string","enum":["seconds","minutes","hours","days","weeks","months","years"]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string","minLength":1}]}},"required":["assetType","targetAmount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"integration"},"config":{"type":"object","properties":{"integrationId":{"type":"string"},"payloadTemplate":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"string"}]},"sql":{"type":"string"},"to":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"}},"required":["integrationId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"apply_referral"},"config":{"type":"object","properties":{"code":{"type":"string","minLength":1},"refereeId":{"type":"string","minLength":1},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["code","refereeId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"complete_referral"},"config":{"type":"object","properties":{"refereeId":{"type":"string","minLength":1}},"required":["refereeId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"update_user"},"config":{"type":"object","properties":{"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"birthday":{"type":"string"},"gender":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"custom_table"},"config":{"type":"object","properties":{"operation":{"type":"string","enum":["insert","update","delete"]},"tableName":{"type":"string","minLength":1},"rowId":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["operation","tableName"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"emit_event"},"config":{"type":"object","properties":{"eventType":{"anyOf":[{"type":"string","minLength":1},{"type":"number"}]},"userId":{"type":["string","number"]},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["eventType"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"mark_code_used"},"config":{"type":"object","properties":{"code":{"anyOf":[{"type":"string","minLength":1},{"type":"number"}]},"refereeId":{"type":["string","number"]}},"required":["code"]}},"required":["type","config"]}]}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"reward"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"},"expirationDate":{"type":"string"},"expiresIn":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"expiresInUnit":{"type":"string","enum":["seconds","minutes","hours","days","weeks","months","years"]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string","minLength":1}]}},"required":["assetType","amount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"redemption"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"}},"required":["assetType","amount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"modify"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"targetAmount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"},"expirationDate":{"type":"string"},"expiresIn":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"expiresInUnit":{"type":"string","enum":["seconds","minutes","hours","days","weeks","months","years"]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string","minLength":1}]}},"required":["assetType","targetAmount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"integration"},"config":{"type":"object","properties":{"integrationId":{"type":"string"},"payloadTemplate":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"string"}]},"sql":{"type":"string"},"to":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"}},"required":["integrationId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"apply_referral"},"config":{"type":"object","properties":{"code":{"type":"string","minLength":1},"refereeId":{"type":"string","minLength":1},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["code","refereeId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"complete_referral"},"config":{"type":"object","properties":{"refereeId":{"type":"string","minLength":1}},"required":["refereeId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"update_user"},"config":{"type":"object","properties":{"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"birthday":{"type":"string"},"gender":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"custom_table"},"config":{"type":"object","properties":{"operation":{"type":"string","enum":["insert","update","delete"]},"tableName":{"type":"string","minLength":1},"rowId":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["operation","tableName"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"emit_event"},"config":{"type":"object","properties":{"eventType":{"anyOf":[{"type":"string","minLength":1},{"type":"number"}]},"userId":{"type":["string","number"]},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["eventType"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"mark_code_used"},"config":{"type":"object","properties":{"code":{"anyOf":[{"type":"string","minLength":1},{"type":"number"}]},"refereeId":{"type":["string","number"]}},"required":["code"]}},"required":["type","config"]}]}]},"resources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string","minLength":1},"type":{"type":"string","enum":["event","internal","http","database","payload","custom_table","code"]},"value":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","key","type","value"]}},"priority":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"isActive":{"type":"boolean"},"validFrom":{"type":["string","null"]},"validTo":{"type":["string","null"]}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdRulesByRuleId","tags":["Rules"],"summary":"Remove a rule","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"ruleId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/rules/{ruleId}/duplicate":{"post":{"operationId":"postProjectsByProjectIdRulesByRuleIdDuplicate","tags":["Rules"],"summary":"Duplicate a rule","responses":{"200":{"description":"Rule duplicated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"ruleId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"newName":{"type":"string"}}}}}}}},"/projects/{projectId}/rules/{ruleId}/history":{"get":{"operationId":"getProjectsByProjectIdRulesByRuleIdHistory","tags":["Rules"],"summary":"Get rule history (last 10 entries)","responses":{"200":{"description":"Rule history","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"ruleId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/clone-to/{targetProjectId}":{"post":{"operationId":"postProjectsByProjectIdCloneToByTargetProjectId","tags":["Rules"],"summary":"Clone rules and resources to another project","responses":{"201":{"description":"Cloned rules and resources","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"targetProjectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ruleIds":{"type":"array","items":{"type":"string","minLength":1}},"includeResources":{"default":true,"type":"boolean"}}}}}}}},"/projects/{projectId}/rules/evaluate":{"post":{"operationId":"postProjectsByProjectIdRulesEvaluate","tags":["Rules"],"summary":"Evaluate all active rules against context","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["context"]}}}}}},"/projects/{projectId}/rules/test":{"post":{"operationId":"postProjectsByProjectIdRulesTest","tags":["Rules"],"summary":"Test conditions against sample context (without saving)","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"conditions":{"type":"object","properties":{"conditions":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"leftValue":{"type":"string","minLength":1},"operator":{"type":"string","enum":["equals","eq","notEquals","neq","gt","greater_than","gte","lt","less_than","lte","contains","notContains","startsWith","endsWith","exists","notExists","regex","before","after","isEmpty","isNotEmpty","hasKey","is_true","is_false","array_contains_where"]},"rightValue":{},"rightType":{"type":"string","enum":["string","number","boolean","datetime","array","object","expression"]}},"required":["leftValue","operator"]}},"combinator":{"type":"string","enum":["AND","OR"]}},"required":["conditions","combinator"]},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["conditions","context"]}}}}}},"/projects/{projectId}/rules/execute-actions":{"post":{"operationId":"postProjectsByProjectIdRulesExecuteActions","tags":["Rules"],"summary":"Execute provided actions directly (for rule builder testing)","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"actions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"reward"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"},"expirationDate":{"type":"string"},"expiresIn":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"expiresInUnit":{"type":"string","enum":["seconds","minutes","hours","days","weeks","months","years"]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string","minLength":1}]}},"required":["assetType","amount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"redemption"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"}},"required":["assetType","amount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"modify"},"config":{"type":"object","properties":{"assetType":{"type":"string"},"targetAmount":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"string","minLength":1},{"type":"object","properties":{"expression":{"type":"string","minLength":1}},"required":["expression"]}]},"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"description":{"type":"string"},"expirationDate":{"type":"string"},"expiresIn":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"expiresInUnit":{"type":"string","enum":["seconds","minutes","hours","days","weeks","months","years"]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string","minLength":1}]}},"required":["assetType","targetAmount"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"integration"},"config":{"type":"object","properties":{"integrationId":{"type":"string"},"payloadTemplate":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"string"}]},"sql":{"type":"string"},"to":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"}},"required":["integrationId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"apply_referral"},"config":{"type":"object","properties":{"code":{"type":"string","minLength":1},"refereeId":{"type":"string","minLength":1},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["code","refereeId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"complete_referral"},"config":{"type":"object","properties":{"refereeId":{"type":"string","minLength":1}},"required":["refereeId"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"update_user"},"config":{"type":"object","properties":{"userId":{"default":"{{ $('event').userId }}","type":["string","number"]},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"birthday":{"type":"string"},"gender":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"custom_table"},"config":{"type":"object","properties":{"operation":{"type":"string","enum":["insert","update","delete"]},"tableName":{"type":"string","minLength":1},"rowId":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["operation","tableName"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"emit_event"},"config":{"type":"object","properties":{"eventType":{"anyOf":[{"type":"string","minLength":1},{"type":"number"}]},"userId":{"type":["string","number"]},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["eventType"]}},"required":["type","config"]},{"type":"object","properties":{"type":{"type":"string","const":"mark_code_used"},"config":{"type":"object","properties":{"code":{"anyOf":[{"type":"string","minLength":1},{"type":"number"}]},"refereeId":{"type":["string","number"]}},"required":["code"]}},"required":["type","config"]}]}},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["actions","context"]}}}}}},"/projects/{projectId}/rules/execute":{"post":{"operationId":"postProjectsByProjectIdRulesExecute","tags":["Rules"],"summary":"Evaluate rules and execute matched actions (rewards + integrations)","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["userId","context"]}}}}}},"/projects/{projectId}/integrations":{"get":{"operationId":"getProjectsByProjectIdIntegrations","tags":["Integrations"],"summary":"List project integrations","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]},"post":{"operationId":"postProjectsByProjectIdIntegrations","tags":["Integrations"],"summary":"Create an integration","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"type":{"type":"string","const":"http"},"config":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"headers":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"authentication":{"type":"object","properties":{"type":{"type":"string","enum":["none","bearer","basic","api-key"]},"token":{"type":"string"},"username":{"type":"string"},"password":{"type":"string"},"key":{"type":"string"},"value":{"type":"string"},"in":{"type":"string","enum":["header","query"]}},"required":["type"]},"bodyTemplate":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"timeout":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"retryConfig":{"type":"object","properties":{"maxRetries":{"type":"integer","minimum":0,"maximum":5},"retryDelay":{"type":"integer","minimum":100,"maximum":30000}},"required":["maxRetries","retryDelay"]}},"required":["url","method"]}},"required":["name","type","config"]},{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"type":{"type":"string","const":"telegram"},"config":{"type":"object","properties":{"botToken":{"type":"string","minLength":1},"chatId":{"type":"string","minLength":1},"parseMode":{"type":"string","enum":["HTML","Markdown","MarkdownV2"]},"messageTemplate":{"type":"string","minLength":1}},"required":["botToken","chatId","messageTemplate"]}},"required":["name","type","config"]},{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"type":{"type":"string","const":"slack"},"config":{"type":"object","properties":{"webhookUrl":{"type":"string","format":"uri"},"channel":{"type":"string"},"username":{"type":"string"},"iconEmoji":{"type":"string"},"messageTemplate":{"type":"string","minLength":1}},"required":["webhookUrl","messageTemplate"]}},"required":["name","type","config"]},{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"type":{"type":"string","const":"postgres"},"config":{"type":"object","properties":{"connectionString":{"type":"string","minLength":1},"ssl":{"default":true,"type":"boolean"}},"required":["connectionString"]}},"required":["name","type","config"]},{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"type":{"type":"string","const":"aws-ses"},"config":{"type":"object","properties":{"region":{"type":"string","minLength":1},"accessKeyId":{"type":"string","minLength":1},"secretAccessKey":{"type":"string","minLength":1},"fromEmail":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"fromName":{"type":"string"}},"required":["region","accessKeyId","secretAccessKey","fromEmail"]}},"required":["name","type","config"]}],"type":"object"}}}}}},"/projects/{projectId}/integrations/{integrationId}":{"get":{"operationId":"getProjectsByProjectIdIntegrationsByIntegrationId","tags":["Integrations"],"summary":"Get a single integration","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Integration not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"integrationId","schema":{"type":"string","minLength":1},"required":true}]},"patch":{"operationId":"patchProjectsByProjectIdIntegrationsByIntegrationId","tags":["Integrations"],"summary":"Update an integration","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Integration not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"integrationId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"config":{"anyOf":[{"type":"object","properties":{"url":{"type":"string","format":"uri"},"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"headers":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"authentication":{"type":"object","properties":{"type":{"type":"string","enum":["none","bearer","basic","api-key"]},"token":{"type":"string"},"username":{"type":"string"},"password":{"type":"string"},"key":{"type":"string"},"value":{"type":"string"},"in":{"type":"string","enum":["header","query"]}},"required":["type"]},"bodyTemplate":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"timeout":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"retryConfig":{"type":"object","properties":{"maxRetries":{"type":"integer","minimum":0,"maximum":5},"retryDelay":{"type":"integer","minimum":100,"maximum":30000}},"required":["maxRetries","retryDelay"]}},"required":["url","method"]},{"type":"object","properties":{"botToken":{"type":"string","minLength":1},"chatId":{"type":"string","minLength":1},"parseMode":{"type":"string","enum":["HTML","Markdown","MarkdownV2"]},"messageTemplate":{"type":"string","minLength":1}},"required":["botToken","chatId","messageTemplate"]},{"type":"object","properties":{"webhookUrl":{"type":"string","format":"uri"},"channel":{"type":"string"},"username":{"type":"string"},"iconEmoji":{"type":"string"},"messageTemplate":{"type":"string","minLength":1}},"required":["webhookUrl","messageTemplate"]},{"type":"object","properties":{"connectionString":{"type":"string","minLength":1},"ssl":{"default":true,"type":"boolean"}},"required":["connectionString"]},{"type":"object","properties":{"region":{"type":"string","minLength":1},"accessKeyId":{"type":"string","minLength":1},"secretAccessKey":{"type":"string","minLength":1},"fromEmail":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"fromName":{"type":"string"}},"required":["region","accessKeyId","secretAccessKey","fromEmail"]}]},"isActive":{"type":"boolean"}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdIntegrationsByIntegrationId","tags":["Integrations"],"summary":"Delete an integration","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"integrationId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/api-key":{"get":{"operationId":"getProjectsByProjectIdApiKey","tags":["API Keys"],"summary":"Get current API key for project","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]},"delete":{"operationId":"deleteProjectsByProjectIdApiKey","tags":["API Keys"],"summary":"Delete the legacy API key for project","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/api-key/generate":{"post":{"operationId":"postProjectsByProjectIdApiKeyGenerate","tags":["API Keys"],"summary":"Generate or rotate API key for project","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/api-keys":{"get":{"operationId":"getProjectsByProjectIdApiKeys","tags":["API Keys"],"summary":"List all API keys for the project","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]},"post":{"operationId":"postProjectsByProjectIdApiKeys","tags":["API Keys"],"summary":"Create a new API key for the project","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"expiresAt":{"type":["string","null"]}},"required":["name"]}}}}}},"/projects/{projectId}/api-keys/{keyId}":{"patch":{"operationId":"patchProjectsByProjectIdApiKeysByKeyId","tags":["API Keys"],"summary":"Update an API key name","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string"},"required":true},{"in":"path","name":"keyId","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100}},"required":["name"]}}}}},"delete":{"operationId":"deleteProjectsByProjectIdApiKeysByKeyId","tags":["API Keys"],"summary":"Revoke (delete) an API key","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string"},"required":true},{"in":"path","name":"keyId","schema":{"type":"string"},"required":true}]}},"/projects/{projectId}/referrals/config":{"get":{"operationId":"getProjectsByProjectIdReferralsConfig","tags":["Referrals"],"summary":"Get referral program config","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"defaultMaxUsesPerCode":{"type":["number","null"]},"defaultMaxUsesPerSystemCode":{"type":["number","null"]},"defaultCodeExpirationDays":{"type":["number","null"]},"referralExpirationDays":{"type":["number","null"]},"codeFormat":{"type":"string","enum":["random","user-prefix"]},"codeLength":{"type":"number"},"codePrefix":{"type":"string"},"codeCharset":{"type":"string","enum":["alphanumeric","alphabetic","numeric","hex"]},"codeSeparator":{"type":"string"},"codeSeparatorInterval":{"type":"number"}},"required":["defaultMaxUsesPerCode","defaultMaxUsesPerSystemCode","defaultCodeExpirationDays","referralExpirationDays","codeFormat","codeLength","codePrefix","codeCharset","codeSeparator","codeSeparatorInterval"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]},"put":{"operationId":"putProjectsByProjectIdReferralsConfig","tags":["Referrals"],"summary":"Update referral program config","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"defaultMaxUsesPerCode":{"type":["number","null"]},"defaultMaxUsesPerSystemCode":{"type":["number","null"]},"defaultCodeExpirationDays":{"type":["number","null"]},"referralExpirationDays":{"type":["number","null"]},"codeFormat":{"type":"string","enum":["random","user-prefix"]},"codeLength":{"type":"number"},"codePrefix":{"type":"string"},"codeCharset":{"type":"string","enum":["alphanumeric","alphabetic","numeric","hex"]},"codeSeparator":{"type":"string"},"codeSeparatorInterval":{"type":"number"}},"required":["defaultMaxUsesPerCode","defaultMaxUsesPerSystemCode","defaultCodeExpirationDays","referralExpirationDays","codeFormat","codeLength","codePrefix","codeCharset","codeSeparator","codeSeparatorInterval"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"defaultMaxUsesPerCode":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"defaultMaxUsesPerSystemCode":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"defaultCodeExpirationDays":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"referralExpirationDays":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"codeFormat":{"type":"string","enum":["random","user-prefix"]},"codeLength":{"type":"integer","minimum":4,"maximum":20},"codePrefix":{"type":"string","maxLength":10,"pattern":"^[A-Z0-9]*$"},"codeCharset":{"type":"string","enum":["alphanumeric","alphabetic","numeric","hex"]},"codeSeparator":{"type":"string","enum":["","-","_"]},"codeSeparatorInterval":{"type":"integer","minimum":0,"maximum":8}}}}}}}},"/projects/{projectId}/referrals/stats":{"get":{"operationId":"getProjectsByProjectIdReferralsStats","tags":["Referrals"],"summary":"Get overall referral statistics","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"totalCodes":{"type":"number"},"activeCodes":{"type":"number"},"totalReferrals":{"type":"number"}},"required":["totalCodes","activeCodes","totalReferrals"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/referrals/stats/{userId}":{"get":{"operationId":"getProjectsByProjectIdReferralsStatsByUserId","tags":["Referrals"],"summary":"Get user referral statistics","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"userId":{"type":"string"},"codesCreated":{"type":"number"},"totalReferrals":{"type":"number"}},"required":["userId","codesCreated","totalReferrals"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"userId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/referrals/leaderboard":{"get":{"operationId":"getProjectsByProjectIdReferralsLeaderboard","tags":["Referrals"],"summary":"Get referral leaderboard","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"referrerId":{"type":"string"},"totalReferrals":{"type":"number"},"completedReferrals":{"type":"number"},"rank":{"type":"number"}},"required":["referrerId","totalReferrals","completedReferrals","rank"]}},"total":{"type":"number"}},"required":["items","total"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}]}},"/projects/{projectId}/referrals/reports":{"get":{"operationId":"getProjectsByProjectIdReferralsReports","tags":["Referrals"],"summary":"Get referral report data with analytics","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"summary":{"type":"object","properties":{"totalCodes":{"type":"number"},"activeCodes":{"type":"number"},"inactiveCodes":{"type":"number"},"expiredCodes":{"type":"number"},"totalReferrals":{"type":"number"},"referralsInPeriod":{"type":"number"},"avgReferralsPerCode":{"type":"number"},"topReferrerCode":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"referrerId":{"type":["string","null"]},"totalUses":{"type":"number"}},"required":["code","referrerId","totalUses"]},{"type":"null"}]}},"required":["totalCodes","activeCodes","inactiveCodes","expiredCodes","totalReferrals","referralsInPeriod","avgReferralsPerCode","topReferrerCode"]},"referralsOverTime":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"count":{"type":"number"}},"required":["date","count"]}},"codeStatusBreakdown":{"type":"array","items":{"type":"object","properties":{"status":{"type":"string"},"count":{"type":"number"}},"required":["status","count"]}},"topCodes":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"referrerId":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"totalUses":{"type":"number"},"status":{"type":"string"}},"required":["code","referrerId","tags","totalUses","status"]}},"topReferrers":{"type":"array","items":{"type":"object","properties":{"referrerId":{"type":"string"},"totalReferrals":{"type":"number"},"code":{"type":"string"}},"required":["referrerId","totalReferrals","code"]}}},"required":["summary","referralsOverTime","codeStatusBreakdown","topCodes","topReferrers"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"start","schema":{"type":"string"}},{"in":"query","name":"end","schema":{"type":"string"}},{"in":"query","name":"topLimit","schema":{"type":"integer","minimum":1,"maximum":50}}]}},"/projects/{projectId}/referrals/export":{"get":{"operationId":"getProjectsByProjectIdReferralsExport","tags":["Referrals"],"summary":"Export referral data as CSV or XLSX","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"type","schema":{"type":"string","enum":["codes","referrals"]},"required":true},{"in":"query","name":"format","schema":{"default":"csv","type":"string","enum":["csv","xlsx"]}},{"in":"query","name":"start","schema":{"type":"string"}},{"in":"query","name":"end","schema":{"type":"string"}}]}},"/projects/{projectId}/referrals/events":{"get":{"operationId":"getProjectsByProjectIdReferralsEvents","tags":["Referrals"],"summary":"List referral events (audit log)","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"referralId":{"type":["string","null"]},"codeId":{"type":["string","null"]},"type":{"type":"string"},"actorId":{"type":["string","null"]},"data":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","referralId","codeId","type","actorId","data","createdAt"]}},"total":{"type":"number"}},"required":["items","total"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"in":"query","name":"referralId","schema":{"type":"string"}},{"in":"query","name":"codeId","schema":{"type":"string"}},{"in":"query","name":"type","schema":{"type":"string","enum":["code.created","code.deactivated","code.reactivated","code.expired","code.max_uses_reached","referral.created"]}},{"in":"query","name":"start","schema":{"type":"string"}},{"in":"query","name":"end","schema":{"type":"string"}}]}},"/projects/{projectId}/referrals":{"post":{"operationId":"postProjectsByProjectIdReferrals","tags":["Referrals"],"summary":"Create a referral code (user-owned or system)","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","inactive","expired"]},"maxUses":{"type":["number","null"]},"currentUses":{"type":"number"},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","code","referrerId","tags","status","maxUses","currentUses","expiresAt","createdAt","updatedAt"]}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"referrerId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"code":{"type":"string"},"maxUses":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"expiresAt":{"type":["string","null"]}}}}}}},"get":{"operationId":"getProjectsByProjectIdReferrals","tags":["Referrals"],"summary":"List referral codes","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","inactive","expired"]},"maxUses":{"type":["number","null"]},"currentUses":{"type":"number"},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","code","referrerId","tags","status","maxUses","currentUses","expiresAt","createdAt","updatedAt"]}},"total":{"type":"number"}},"required":["items","total"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"in":"query","name":"referrerId","schema":{"type":"string"}},{"in":"query","name":"code","schema":{"type":"string"}},{"in":"query","name":"tag","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string","enum":["active","inactive","expired"]}},{"in":"query","name":"type","schema":{"type":"string","enum":["system","user"]}},{"in":"query","name":"start","schema":{"type":"string"}},{"in":"query","name":"end","schema":{"type":"string"}}]}},"/projects/{projectId}/referrals/bulk":{"post":{"operationId":"postProjectsByProjectIdReferralsBulk","tags":["Referrals"],"summary":"Bulk create referral codes","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","inactive","expired"]},"maxUses":{"type":["number","null"]},"currentUses":{"type":"number"},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","code","referrerId","tags","status","maxUses","currentUses","expiresAt","createdAt","updatedAt"]}},"total":{"type":"number"}},"required":["items","total"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","minimum":1,"maximum":1000},"tags":{"type":"array","items":{"type":"string"}},"maxUses":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"expiresAt":{"type":"string"}},"required":["count"]}}}}}},"/projects/{projectId}/referrals/validate":{"post":{"operationId":"postProjectsByProjectIdReferralsValidate","tags":["Referrals"],"summary":"Validate a referral code (check validity without applying)","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"valid":{"type":"boolean","const":true},"code":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","inactive","expired"]},"maxUses":{"type":["number","null"]},"currentUses":{"type":"number"},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","code","referrerId","tags","status","maxUses","currentUses","expiresAt","createdAt","updatedAt"]}},"required":["valid","code"]}},"required":["success","data"]}}}},"400":{"description":"Invalid code","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1},"refereeId":{"type":"string"}},"required":["code"]}}}}}},"/projects/{projectId}/referrals/lookup/{code}":{"get":{"operationId":"getProjectsByProjectIdReferralsLookupByCode","tags":["Referrals"],"summary":"Lookup a referral code by code string","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","inactive","expired"]},"maxUses":{"type":["number","null"]},"currentUses":{"type":"number"},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","code","referrerId","tags","status","maxUses","currentUses","expiresAt","createdAt","updatedAt"]}},"required":["success","data"]}}}},"404":{"description":"Code not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"code","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/referrals/referrer/{referrerId}":{"get":{"operationId":"getProjectsByProjectIdReferralsReferrerByReferrerId","tags":["Referrals"],"summary":"Get referral code by referrer ID","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","inactive","expired"]},"maxUses":{"type":["number","null"]},"currentUses":{"type":"number"},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","code","referrerId","tags","status","maxUses","currentUses","expiresAt","createdAt","updatedAt"]}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"referrerId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/referrals/apply":{"post":{"operationId":"postProjectsByProjectIdReferralsApply","tags":["Referrals"],"summary":"Apply (use) a referral code","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"id":{"type":"string"},"codeId":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"refereeId":{"type":"string"},"completedAt":{"type":"string"},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","codeId","code","referrerId","refereeId","completedAt","expiresAt","createdAt","updatedAt"]}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1},"refereeId":{"type":"string","minLength":1}},"required":["code","refereeId"]}}}}}},"/projects/{projectId}/referrals/usages":{"get":{"operationId":"getProjectsByProjectIdReferralsUsages","tags":["Referrals"],"summary":"List referral usage","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"codeId":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"refereeId":{"type":"string"},"completedAt":{"type":"string"},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","codeId","code","referrerId","refereeId","completedAt","expiresAt","createdAt","updatedAt"]}},"total":{"type":"number"}},"required":["items","total"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"in":"query","name":"referrerId","schema":{"type":"string"}},{"in":"query","name":"refereeId","schema":{"type":"string"}},{"in":"query","name":"codeId","schema":{"type":"string"}},{"in":"query","name":"start","schema":{"type":"string"}},{"in":"query","name":"end","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string","enum":["pending","completed","expired","cancelled"]}}]}},"/projects/{projectId}/referrals/usages/{referralId}":{"get":{"operationId":"getProjectsByProjectIdReferralsUsagesByReferralId","tags":["Referrals"],"summary":"Get a single referral","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"id":{"type":"string"},"codeId":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"refereeId":{"type":"string"},"completedAt":{"type":"string"},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","codeId","code","referrerId","refereeId","completedAt","expiresAt","createdAt","updatedAt"]}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"referralId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/referrals/{codeId}":{"get":{"operationId":"getProjectsByProjectIdReferralsByCodeId","tags":["Referrals"],"summary":"Get a referral code by ID","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","inactive","expired"]},"maxUses":{"type":["number","null"]},"currentUses":{"type":"number"},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","code","referrerId","tags","status","maxUses","currentUses","expiresAt","createdAt","updatedAt"]}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"codeId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/referrals/{codeId}/analytics":{"get":{"operationId":"getProjectsByProjectIdReferralsByCodeIdAnalytics","tags":["Referrals"],"summary":"Get detailed analytics for a code","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"codeId":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string"},"totalUses":{"type":"number"},"usageOverTime":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"count":{"type":"number"}},"required":["date","count"]}}},"required":["codeId","code","referrerId","tags","status","totalUses","usageOverTime"]}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"codeId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/referrals/{code}":{"patch":{"operationId":"patchProjectsByProjectIdReferralsByCode","tags":["Referrals"],"summary":"Update a referral code","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","inactive","expired"]},"maxUses":{"type":["number","null"]},"currentUses":{"type":"number"},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","code","referrerId","tags","status","maxUses","currentUses","expiresAt","createdAt","updatedAt"]}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"code","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active","inactive"]}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdReferralsByCode","tags":["Referrals"],"summary":"Delete a referral code","description":"Permanently deletes the code so it can no longer be used. Referral usages and audit events are preserved for historical reporting. This cannot be undone.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"referrerId":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","inactive","expired"]},"maxUses":{"type":["number","null"]},"currentUses":{"type":"number"},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","code","referrerId","tags","status","maxUses","currentUses","expiresAt","createdAt","updatedAt"]}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"code","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/tickets":{"post":{"operationId":"postProjectsByProjectIdTickets","tags":["Support"],"summary":"Create a ticket (backoffice)","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"category":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"images":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"url":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"size":{"type":"number","minimum":0},"mimeType":{"type":"string","minLength":1}},"required":["url","name","size","mimeType"]}},"externalUserId":{"type":"string"},"customerEmail":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"customerName":{"type":"string"},"createdBy":{"type":"string"}},"required":["title","description"]}}}}},"get":{"operationId":"getProjectsByProjectIdTickets","tags":["Support"],"summary":"List tickets","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"in":"query","name":"status","schema":{"type":"string","enum":["open","in_progress","resolved","closed"]}},{"in":"query","name":"activeOnly","schema":{"type":"string"}},{"in":"query","name":"priority","schema":{"type":"string"}},{"in":"query","name":"assigneeId","schema":{"type":"string"}},{"in":"query","name":"category","schema":{"type":"string"}},{"in":"query","name":"dateFrom","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"in":"query","name":"dateTo","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}]}},"/projects/{projectId}/tickets/stats":{"get":{"operationId":"getProjectsByProjectIdTicketsStats","tags":["Support"],"summary":"Get ticket statistics","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/tickets/{ticketId}":{"get":{"operationId":"getProjectsByProjectIdTicketsByTicketId","tags":["Support"],"summary":"Get a ticket","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Ticket not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"ticketId","schema":{"type":"string","minLength":1},"required":true}]},"patch":{"operationId":"patchProjectsByProjectIdTicketsByTicketId","tags":["Support"],"summary":"Update a ticket","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Ticket not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"ticketId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"status":{"type":"string","enum":["open","in_progress","resolved","closed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"category":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"images":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"url":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"size":{"type":"number","minimum":0},"mimeType":{"type":"string","minLength":1},"createdAt":{"type":"string"}},"required":["id","url","name","size","mimeType","createdAt"]}},"assigneeId":{"type":["string","null"]},"assigneeName":{"type":["string","null"]},"note":{"type":"string"}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdTicketsByTicketId","tags":["Support"],"summary":"Delete a ticket","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"404":{"description":"Ticket not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"ticketId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/tickets/{ticketId}/notes":{"get":{"operationId":"getProjectsByProjectIdTicketsByTicketIdNotes","tags":["Support"],"summary":"List internal notes for a ticket","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"ticketId","schema":{"type":"string","minLength":1},"required":true}]},"post":{"operationId":"postProjectsByProjectIdTicketsByTicketIdNotes","tags":["Support"],"summary":"Add an internal note to a ticket","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Ticket not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"ticketId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","minLength":1}},"required":["content"]}}}}}},"/projects/{projectId}/tickets/{ticketId}/history":{"get":{"operationId":"getProjectsByProjectIdTicketsByTicketIdHistory","tags":["Support"],"summary":"Get change history for a ticket","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"ticketId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/ticket-categories":{"get":{"operationId":"getProjectsByProjectIdTicketCategories","tags":["Support"],"summary":"List ticket categories","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]},"post":{"operationId":"postProjectsByProjectIdTicketCategories","tags":["Support"],"summary":"Create a ticket category","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64}},"required":["name"]}}}}}},"/projects/{projectId}/ticket-categories/{categoryId}":{"patch":{"operationId":"patchProjectsByProjectIdTicketCategoriesByCategoryId","tags":["Support"],"summary":"Rename a ticket category","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Category not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"categoryId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64}},"required":["name"]}}}}},"delete":{"operationId":"deleteProjectsByProjectIdTicketCategoriesByCategoryId","tags":["Support"],"summary":"Delete a ticket category","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"404":{"description":"Category not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"409":{"description":"Category is in use","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"categoryId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/surveys":{"post":{"operationId":"postProjectsByProjectIdSurveys","tags":["Surveys"],"summary":"Create a survey","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"description":{"type":"string"},"questions":{"minItems":1,"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["multiple_choice","multi_select","text","rating","yes_no"]},"question":{"type":"string","minLength":1},"options":{"type":"array","items":{"type":"string"}},"required":{"default":false,"type":"boolean"},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ratingMax":{"type":"integer","minimum":2,"maximum":10}},"required":["type","question"]}},"createdBy":{"type":"string"}},"required":["title","questions","createdBy"]}}}}},"get":{"operationId":"getProjectsByProjectIdSurveys","tags":["Surveys"],"summary":"List surveys","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"in":"query","name":"status","schema":{"type":"string","enum":["draft","active","closed"]}}]}},"/projects/{projectId}/surveys/{surveyId}":{"get":{"operationId":"getProjectsByProjectIdSurveysBySurveyId","tags":["Surveys"],"summary":"Get a survey","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Survey not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"surveyId","schema":{"type":"string","minLength":1},"required":true}]},"patch":{"operationId":"patchProjectsByProjectIdSurveysBySurveyId","tags":["Surveys"],"summary":"Update a survey","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Survey not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"surveyId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"description":{"type":["string","null"]},"questions":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["multiple_choice","multi_select","text","rating","yes_no"]},"question":{"type":"string","minLength":1},"options":{"type":"array","items":{"type":"string"}},"required":{"default":false,"type":"boolean"},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ratingMax":{"type":"integer","minimum":2,"maximum":10}},"required":["type","question"]}},"status":{"type":"string","enum":["draft","active","closed"]}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdSurveysBySurveyId","tags":["Surveys"],"summary":"Delete a survey","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"surveyId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/surveys/{surveyId}/responses":{"get":{"operationId":"getProjectsByProjectIdSurveysBySurveyIdResponses","tags":["Surveys"],"summary":"List survey responses","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"surveyId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}]}},"/projects/{projectId}/surveys/{surveyId}/stats":{"get":{"operationId":"getProjectsByProjectIdSurveysBySurveyIdStats","tags":["Surveys"],"summary":"Get aggregated survey stats","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Survey not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"surveyId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/workflows":{"get":{"operationId":"getProjectsByProjectIdWorkflows","tags":["Workflows"],"summary":"List workflows for a project","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"in":"query","name":"status","schema":{"type":"string","enum":["pending","running","completed","failed"]}},{"in":"query","name":"eventType","schema":{"type":"string"}},{"in":"query","name":"eventId","schema":{"type":"string"}},{"in":"query","name":"resolvedUserId","schema":{"type":"string"}},{"in":"query","name":"dateFrom","schema":{"type":"string"}},{"in":"query","name":"dateTo","schema":{"type":"string"}}]}},"/projects/{projectId}/workflows/stats":{"get":{"operationId":"getProjectsByProjectIdWorkflowsStats","tags":["Workflows"],"summary":"Get workflow statistics","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/workflows/{workflowId}":{"get":{"operationId":"getProjectsByProjectIdWorkflowsByWorkflowId","tags":["Workflows"],"summary":"Get a single workflow detail","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Workflow not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"workflowId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/workflows/{workflowId}/full":{"get":{"operationId":"getProjectsByProjectIdWorkflowsByWorkflowIdFull","tags":["Workflows"],"summary":"Get full workflow detail from R2","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Workflow not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"workflowId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/promotions/coupons/lookup/{code}":{"get":{"operationId":"getProjectsByProjectIdPromotionsCouponsLookupByCode","tags":["Promotions - Coupons"],"summary":"Lookup coupon by code","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Coupon not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"code","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/promotions/coupons/{couponId}":{"patch":{"operationId":"patchProjectsByProjectIdPromotionsCouponsByCouponId","tags":["Promotions - Coupons"],"summary":"Update a coupon","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Coupon not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"couponId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"maxUses":{"description":"Max total uses","anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"maxUsesPerUser":{"description":"Max uses per user","anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"status":{"description":"Coupon status","type":"string","enum":["active","inactive","expired","exhausted"]},"validFrom":{"description":"Valid from date (ISO string)","anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"validTo":{"description":"Valid to date (ISO string)","anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdPromotionsCouponsByCouponId","tags":["Promotions - Coupons"],"summary":"Delete a coupon","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"couponId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/promotions/usage/{usageId}":{"get":{"operationId":"getProjectsByProjectIdPromotionsUsageByUsageId","tags":["Promotions - Usage"],"summary":"Get a single usage record","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Usage not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"usageId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/promotions/usage/{usageId}/cancel":{"post":{"operationId":"postProjectsByProjectIdPromotionsUsageByUsageIdCancel","tags":["Promotions - Usage"],"summary":"Cancel a usage record","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Usage not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"409":{"description":"Already cancelled or checkout pending","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"usageId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/promotions/usage":{"get":{"operationId":"getProjectsByProjectIdPromotionsUsage","tags":["Promotions - Usage"],"summary":"List usage records","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"promotionId","schema":{"type":"string"}},{"in":"query","name":"userId","schema":{"type":"string"}},{"in":"query","name":"orderId","schema":{"type":"string"}},{"in":"query","name":"transactionId","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string","enum":["pending","active","cancelled"]}},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"in":"query","name":"pageSize","schema":{"default":100,"type":"integer","minimum":1,"maximum":100}}]}},"/projects/{projectId}/promotions/stats":{"get":{"operationId":"getProjectsByProjectIdPromotionsStats","tags":["Promotions - Stats"],"summary":"Aggregate promotion stats","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/promotions/execute-script":{"post":{"operationId":"postProjectsByProjectIdPromotionsExecuteScript","tags":["Promotions"],"summary":"Execute a discount computation script in the sandbox","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"script":{"type":"string","minLength":1},"evalCtx":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["script"]}}}}}},"/projects/{projectId}/promotions/evaluate":{"post":{"operationId":"postProjectsByProjectIdPromotionsEvaluate","tags":["Promotions"],"summary":"Evaluate cart against promotions","responses":{"200":{"description":"Evaluation result with applied/not-applied promotions","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"applied":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Promotion ID"},"name":{"type":"string","description":"Promotion name"},"couponCode":{"description":"Coupon code used to activate this promotion","type":"string"},"totalDiscount":{"type":"number","description":"Total discount amount from this promotion"},"discounts":{"type":"array","items":{"type":"object","properties":{"promotionId":{"type":"string"},"promotionName":{"type":"string"},"amount":{"type":"number"},"description":{"type":"string"},"affectedItemIds":{"type":"array","items":{"type":"string"}}},"required":["promotionId","promotionName","amount","description","affectedItemIds"]},"description":"Per-item discount line items"}},"required":["id","name","totalDiscount","discounts"]},"description":"Promotions that were applied with their discounts"},"notApplied":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Promotion ID"},"name":{"type":"string","description":"Promotion name"},"reason":{"type":"string","enum":["conditions_not_met","computation_no_discount","excluded_by_stacking","coupon_required","invalid_conditions","computation_error","expired","not_yet_active","capacity_exhausted","budget_exhausted","inactive","depleted"],"description":"Machine-readable reason code"},"message":{"type":"string","description":"Human-readable explanation of why the promotion was not applied"},"suggestion":{"description":"Actionable suggestion for the user to qualify","type":"string"},"failedConditions":{"description":"Per-condition failure details (only when reason is conditions_not_met)","type":"array","items":{"type":"object","properties":{"field":{"type":"string","description":"The condition left-value expression (e.g. \"cart.total\")"},"operator":{"type":"string","description":"The comparison operator (e.g. \"gte\", \"equals\")"},"expected":{"description":"The right-hand value required by the condition"},"actual":{"description":"The actual resolved value from the evaluation context"},"message":{"type":"string","description":"Human-readable explanation of why this condition failed"}},"required":["field","operator","expected","actual","message"]}},"status":{"description":"The promotion's stored status (when reason is inactive or depleted)","type":"string","enum":["draft","active","paused","expired","depleted"]},"startsAt":{"description":"ISO timestamp the promotion becomes valid (when reason is not_yet_active)","type":"string"}},"required":["id","name","reason","message"]},"description":"Promotions that were not applied with reasons and suggestions"},"trace":{"description":"Per-promotion record of what the engine did and why, in evaluation order — every candidate appears exactly once","type":"array","items":{"type":"object","properties":{"promotionId":{"type":"string"},"promotionName":{"type":"string"},"order":{"description":"0-based position in the priority-sorted evaluation order; null if pre-filtered","type":["number","null"]},"priority":{"type":"number"},"stackingMode":{"type":"string","enum":["stackable","exclusive","exclusive_group"]},"stackingGroup":{"type":["string","null"]},"conditionsMatched":{"type":"boolean"},"computationMatched":{"type":"boolean"},"provisionalDiscount":{"type":"number","description":"What this promotion would have taken on an undiscounted cart"},"finalDiscount":{"type":"number","description":"What it actually took after compounding, stacking and budget clamping"},"excludedByStacking":{"type":"boolean"},"excludedBy":{"description":"Name of the promotion that beat this one","type":"string"},"budgetClamped":{"type":"boolean","description":"True when remaining budget cut the discount short"},"outcome":{"type":"string","enum":["applied","not_applied","pre_filtered"]},"reason":{"type":"string"}},"required":["promotionId","promotionName","order","priority","stackingMode","stackingGroup","conditionsMatched","computationMatched","provisionalDiscount","finalDiscount","excludedByStacking","budgetClamped","outcome"]}},"items":{"type":"array","items":{"type":"object","properties":{"lineIndex":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Position of the line in the request cart.items; disambiguates repeated item ids"},"itemId":{"type":"string"},"variantId":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"originalLineTotal":{"type":"number","description":"Original line total (unitPrice × quantity)"},"discountTotal":{"type":"number"},"discountPercentage":{"type":"number","description":"Discount as percentage of original line total"},"adjustedUnitPrice":{"type":"number","description":"Rounded adjusted price per unit"},"lineTotal":{"type":"number","description":"Final line total (originalLineTotal minus exact discountTotal)"},"adjustments":{"type":"array","items":{"type":"object","properties":{"promotionId":{"type":"string"},"promotionName":{"type":"string"},"amount":{"type":"number"},"couponCode":{"type":"string"}},"required":["promotionId","promotionName","amount"]}}},"required":["lineIndex","itemId","quantity","unitPrice","originalLineTotal","discountTotal","discountPercentage","adjustedUnitPrice","lineTotal","adjustments"]},"description":"Per-item adjustment details (only items with discounts)"},"shippingMethods":{"description":"Per-shipping-method adjustment details","type":"array","items":{"type":"object","properties":{"shippingMethodId":{"type":"string"},"originalAmount":{"type":"number"},"discountTotal":{"type":"number"},"adjustedAmount":{"type":"number"},"adjustments":{"type":"array","items":{"type":"object","properties":{"promotionId":{"type":"string"},"amount":{"type":"number"}},"required":["promotionId","amount"]}}},"required":["shippingMethodId","originalAmount","discountTotal","adjustedAmount","adjustments"]}},"redemptions":{"description":"Redemption instructions emitted by custom scripts (type, amount, promotion id)","type":"array","items":{"type":"object","properties":{"type":{"type":"string","description":"Asset type to redeem (e.g. points)"},"amount":{"type":"number","description":"Amount to redeem"},"id":{"type":"string","description":"Promotion ID that triggered this redemption"}},"required":["type","amount","id"]}},"summary":{"type":"object","properties":{"itemsOriginalTotal":{"type":"number"},"itemsDiscountTotal":{"type":"number"},"shippingOriginalTotal":{"type":"number"},"shippingDiscountTotal":{"type":"number"},"discountTotal":{"type":"number"},"total":{"type":"number"},"savingsPercentage":{"type":"number","description":"Discount as percentage of items original total"},"currencyCode":{"type":"string"},"appliedCount":{"type":"number"}},"required":["itemsOriginalTotal","itemsDiscountTotal","shippingOriginalTotal","shippingDiscountTotal","discountTotal","total","savingsPercentage","currencyCode","appliedCount"]},"warnings":{"type":"array","items":{"type":"string"},"description":"Warnings from coupon validation or cart normalization"},"dryRun":{"type":"boolean","description":"Whether this was a dry-run evaluation (no usage recorded)"},"usages":{"description":"Present when dryRun is explicitly false","type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"transactionId":{"type":"string"}},"required":["id","transactionId"]}},"duplicate":{"description":"True when the response is a duplicate of an existing transaction (idempotent return)","type":"boolean"}},"required":["applied","notApplied","items","summary","warnings","dryRun"]}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"409":{"description":"Stale, cancelled or conflicting checkout","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"cart":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"couponCodes":{"type":"array","items":{"type":"string"}},"promotionIds":{"type":"array","items":{"type":"string"}},"dryRun":{"type":"boolean"},"orderId":{"type":"string"},"transactionId":{"type":"string"},"includeInactive":{"type":"boolean"},"includeInactiveIds":{"type":"array","items":{"type":"string"}}},"required":["cart"]}}}}}},"/projects/{projectId}/promotions":{"post":{"operationId":"postProjectsByProjectIdPromotions","tags":["Promotions"],"summary":"Create a promotion","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Promotion name"},"description":{"description":"Promotion description","type":["string","null"]},"conditions":{"description":"Condition group that must match for promotion to apply","type":"object","properties":{"conditions":{"type":"array","items":{"type":"object","properties":{"leftValue":{"type":"string","minLength":1},"operator":{"type":"string","enum":["equals","eq","notEquals","neq","gt","greater_than","gte","lt","less_than","lte","contains","notContains","startsWith","endsWith","exists","notExists","regex","before","after","isEmpty","isNotEmpty","hasKey","is_true","is_false","array_contains_where"]},"rightValue":{},"rightType":{"type":"string","enum":["string","number","boolean","datetime","array","object","expression"]}},"required":["leftValue","operator"]}},"combinator":{"type":"string","enum":["AND","OR"]}},"required":["conditions","combinator"]},"applicationMethod":{"description":"Application method defining how the discount is applied","oneOf":[{"type":"object","properties":{"methodType":{"type":"string","const":"standard"},"discountType":{"type":"string","enum":["fixed","percentage"]},"targetType":{"type":"string","enum":["items","shipping","order"]},"allocation":{"type":"string","enum":["each","across"]},"value":{"type":"number","exclusiveMinimum":0},"maxQuantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"targetRules":{"type":"object","properties":{"conditions":{"type":"array","items":{"type":"object","properties":{"leftValue":{"type":"string","minLength":1},"operator":{"type":"string","enum":["equals","eq","notEquals","neq","gt","greater_than","gte","lt","less_than","lte","contains","notContains","startsWith","endsWith","exists","notExists","regex","before","after","isEmpty","isNotEmpty","hasKey","is_true","is_false","array_contains_where"]},"rightValue":{},"rightType":{"type":"string","enum":["string","number","boolean","datetime","array","object","expression"]}},"required":["leftValue","operator"]}},"combinator":{"type":"string","enum":["AND","OR"]}},"required":["conditions","combinator"]}},"required":["methodType","discountType","targetType","allocation","value"]},{"type":"object","properties":{"methodType":{"type":"string","const":"buyget"},"buyRules":{"type":"object","properties":{"conditions":{"type":"array","items":{"type":"object","properties":{"leftValue":{"type":"string","minLength":1},"operator":{"type":"string","enum":["equals","eq","notEquals","neq","gt","greater_than","gte","lt","less_than","lte","contains","notContains","startsWith","endsWith","exists","notExists","regex","before","after","isEmpty","isNotEmpty","hasKey","is_true","is_false","array_contains_where"]},"rightValue":{},"rightType":{"type":"string","enum":["string","number","boolean","datetime","array","object","expression"]}},"required":["leftValue","operator"]}},"combinator":{"type":"string","enum":["AND","OR"]}},"required":["conditions","combinator"]},"buyQuantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"targetRules":{"type":"object","properties":{"conditions":{"type":"array","items":{"type":"object","properties":{"leftValue":{"type":"string","minLength":1},"operator":{"type":"string","enum":["equals","eq","notEquals","neq","gt","greater_than","gte","lt","less_than","lte","contains","notContains","startsWith","endsWith","exists","notExists","regex","before","after","isEmpty","isNotEmpty","hasKey","is_true","is_false","array_contains_where"]},"rightValue":{},"rightType":{"type":"string","enum":["string","number","boolean","datetime","array","object","expression"]}},"required":["leftValue","operator"]}},"combinator":{"type":"string","enum":["AND","OR"]}},"required":["conditions","combinator"]},"targetQuantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"discountType":{"type":"string","enum":["fixed","percentage"]},"value":{"type":"number","exclusiveMinimum":0}},"required":["methodType","buyRules","buyQuantity","targetRules","targetQuantity","discountType","value"]},{"type":"object","properties":{"methodType":{"type":"string","const":"custom_script"},"script":{"type":"string","minLength":1},"language":{"type":"string","enum":["javascript","typescript"]}},"required":["methodType","script","language"]}],"type":"object"},"itemsDiscountComputation":{"description":"Items discount computation script (deprecated: use applicationMethod)","type":"object","properties":{"script":{"type":"string","minLength":1},"language":{"type":"string","enum":["javascript","typescript"]}},"required":["script","language"]},"priority":{"description":"Priority (higher = evaluated first)","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stackingMode":{"description":"How this promotion stacks with others","type":"string","enum":["stackable","exclusive","exclusive_group"]},"stackingGroup":{"description":"Stacking group name","type":["string","null"]},"requiresCoupon":{"description":"Whether a coupon code is required","type":"boolean"},"maxTotalUses":{"description":"Max total uses","anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"maxUsesPerUser":{"description":"Max uses per user","anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"budgetCap":{"description":"Budget cap","anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"status":{"description":"Promotion status","type":"string","enum":["draft","active","paused","expired","depleted"]},"validFrom":{"description":"Valid from date (ISO string)","anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"validTo":{"description":"Valid to date (ISO string)","anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"resources":{"description":"Sample resource data","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"metadata":{"description":"Arbitrary metadata","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"changedBy":{"description":"Email of the user who made the change","type":"string"}},"required":["name"]}}}}},"get":{"operationId":"getProjectsByProjectIdPromotions","tags":["Promotions"],"summary":"List promotions","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"status","schema":{"type":"string","enum":["draft","active","paused","expired","depleted"]}},{"in":"query","name":"activeOnly","schema":{"type":"string","enum":["true","false"]}},{"in":"query","name":"stackingGroup","schema":{"type":"string"}},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}]}},"/projects/{projectId}/promotions/{promotionId}/coupons":{"post":{"operationId":"postProjectsByProjectIdPromotionsByPromotionIdCoupons","tags":["Promotions - Coupons"],"summary":"Create a coupon for a promotion","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Promotion not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"409":{"description":"Coupon code already exists","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"promotionId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"Coupon code string"},"prefix":{"description":"Prefix for generated code","type":"string"},"maxUses":{"description":"Max total uses","anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"maxUsesPerUser":{"description":"Max uses per user","anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"validFrom":{"description":"Valid from date (ISO string)","anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"validTo":{"description":"Valid to date (ISO string)","anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}}}},"get":{"operationId":"getProjectsByProjectIdPromotionsByPromotionIdCoupons","tags":["Promotions - Coupons"],"summary":"List coupons for a promotion","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"promotionId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"status","schema":{"type":"string"}},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"in":"query","name":"pageSize","schema":{"type":"integer","minimum":1,"maximum":100}}]}},"/projects/{projectId}/promotions/{promotionId}/coupons/bulk":{"post":{"operationId":"postProjectsByProjectIdPromotionsByPromotionIdCouponsBulk","tags":["Promotions - Coupons"],"summary":"Bulk create coupons for a promotion","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Promotion not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"409":{"description":"Coupon code already exists","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"promotionId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","exclusiveMinimum":0,"maximum":1000,"description":"Number of coupons to generate (1-1000)"},"prefix":{"description":"Prefix for generated codes (e.g. \"SAVE10\" → \"SAVE10-ABC1D2EF\")","type":"string"},"maxUses":{"description":"Max total uses","anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"maxUsesPerUser":{"description":"Max uses per user","anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"validFrom":{"description":"Valid from date (ISO string)","anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"validTo":{"description":"Valid to date (ISO string)","anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["count"]}}}}}},"/projects/{projectId}/promotions/{promotionId}/usage":{"get":{"operationId":"getProjectsByProjectIdPromotionsByPromotionIdUsage","tags":["Promotions - Usage"],"summary":"List usage for a promotion","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"promotionId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"in":"query","name":"pageSize","schema":{"default":100,"type":"integer","minimum":1,"maximum":100}}]}},"/projects/{projectId}/promotions/{promotionId}/stats":{"get":{"operationId":"getProjectsByProjectIdPromotionsByPromotionIdStats","tags":["Promotions - Stats"],"summary":"Get stats for a promotion","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Promotion not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"promotionId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/promotions/{promotionId}/history":{"get":{"operationId":"getProjectsByProjectIdPromotionsByPromotionIdHistory","tags":["Promotions"],"summary":"Get promotion history (last 10 entries)","responses":{"200":{"description":"Promotion history","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"promotionId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/promotions/{promotionId}":{"get":{"operationId":"getProjectsByProjectIdPromotionsByPromotionId","tags":["Promotions"],"summary":"Get a single promotion","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Promotion not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"promotionId","schema":{"type":"string","minLength":1},"required":true}]},"patch":{"operationId":"patchProjectsByProjectIdPromotionsByPromotionId","tags":["Promotions"],"summary":"Update a promotion","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Promotion not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"promotionId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"Promotion name","type":"string","minLength":1},"description":{"description":"Promotion description","type":["string","null"]},"conditions":{"description":"Condition group that must match for promotion to apply","type":"object","properties":{"conditions":{"type":"array","items":{"type":"object","properties":{"leftValue":{"type":"string","minLength":1},"operator":{"type":"string","enum":["equals","eq","notEquals","neq","gt","greater_than","gte","lt","less_than","lte","contains","notContains","startsWith","endsWith","exists","notExists","regex","before","after","isEmpty","isNotEmpty","hasKey","is_true","is_false","array_contains_where"]},"rightValue":{},"rightType":{"type":"string","enum":["string","number","boolean","datetime","array","object","expression"]}},"required":["leftValue","operator"]}},"combinator":{"type":"string","enum":["AND","OR"]}},"required":["conditions","combinator"]},"applicationMethod":{"description":"Application method defining how the discount is applied","oneOf":[{"type":"object","properties":{"methodType":{"type":"string","const":"standard"},"discountType":{"type":"string","enum":["fixed","percentage"]},"targetType":{"type":"string","enum":["items","shipping","order"]},"allocation":{"type":"string","enum":["each","across"]},"value":{"type":"number","exclusiveMinimum":0},"maxQuantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"targetRules":{"type":"object","properties":{"conditions":{"type":"array","items":{"type":"object","properties":{"leftValue":{"type":"string","minLength":1},"operator":{"type":"string","enum":["equals","eq","notEquals","neq","gt","greater_than","gte","lt","less_than","lte","contains","notContains","startsWith","endsWith","exists","notExists","regex","before","after","isEmpty","isNotEmpty","hasKey","is_true","is_false","array_contains_where"]},"rightValue":{},"rightType":{"type":"string","enum":["string","number","boolean","datetime","array","object","expression"]}},"required":["leftValue","operator"]}},"combinator":{"type":"string","enum":["AND","OR"]}},"required":["conditions","combinator"]}},"required":["methodType","discountType","targetType","allocation","value"]},{"type":"object","properties":{"methodType":{"type":"string","const":"buyget"},"buyRules":{"type":"object","properties":{"conditions":{"type":"array","items":{"type":"object","properties":{"leftValue":{"type":"string","minLength":1},"operator":{"type":"string","enum":["equals","eq","notEquals","neq","gt","greater_than","gte","lt","less_than","lte","contains","notContains","startsWith","endsWith","exists","notExists","regex","before","after","isEmpty","isNotEmpty","hasKey","is_true","is_false","array_contains_where"]},"rightValue":{},"rightType":{"type":"string","enum":["string","number","boolean","datetime","array","object","expression"]}},"required":["leftValue","operator"]}},"combinator":{"type":"string","enum":["AND","OR"]}},"required":["conditions","combinator"]},"buyQuantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"targetRules":{"type":"object","properties":{"conditions":{"type":"array","items":{"type":"object","properties":{"leftValue":{"type":"string","minLength":1},"operator":{"type":"string","enum":["equals","eq","notEquals","neq","gt","greater_than","gte","lt","less_than","lte","contains","notContains","startsWith","endsWith","exists","notExists","regex","before","after","isEmpty","isNotEmpty","hasKey","is_true","is_false","array_contains_where"]},"rightValue":{},"rightType":{"type":"string","enum":["string","number","boolean","datetime","array","object","expression"]}},"required":["leftValue","operator"]}},"combinator":{"type":"string","enum":["AND","OR"]}},"required":["conditions","combinator"]},"targetQuantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"discountType":{"type":"string","enum":["fixed","percentage"]},"value":{"type":"number","exclusiveMinimum":0}},"required":["methodType","buyRules","buyQuantity","targetRules","targetQuantity","discountType","value"]},{"type":"object","properties":{"methodType":{"type":"string","const":"custom_script"},"script":{"type":"string","minLength":1},"language":{"type":"string","enum":["javascript","typescript"]}},"required":["methodType","script","language"]}],"type":"object"},"itemsDiscountComputation":{"description":"Items discount computation script (deprecated: use applicationMethod)","type":"object","properties":{"script":{"type":"string","minLength":1},"language":{"type":"string","enum":["javascript","typescript"]}},"required":["script","language"]},"priority":{"description":"Priority (higher = evaluated first)","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stackingMode":{"description":"How this promotion stacks with others","type":"string","enum":["stackable","exclusive","exclusive_group"]},"stackingGroup":{"description":"Stacking group name","type":["string","null"]},"requiresCoupon":{"description":"Whether a coupon code is required","type":"boolean"},"maxTotalUses":{"description":"Max total uses","anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"maxUsesPerUser":{"description":"Max uses per user","anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"budgetCap":{"description":"Budget cap","anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"status":{"description":"Promotion status","type":"string","enum":["draft","active","paused","expired","depleted"]},"validFrom":{"description":"Valid from date (ISO string)","anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"validTo":{"description":"Valid to date (ISO string)","anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"resources":{"description":"Sample resource data","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"metadata":{"description":"Arbitrary metadata","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"isActive":{"description":"Whether the promotion is active","type":"boolean"},"changedBy":{"description":"Email of the user who made the change","type":"string"}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdPromotionsByPromotionId","tags":["Promotions"],"summary":"Delete a promotion","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"404":{"description":"Promotion not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"promotionId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/promotions/{promotionId}/duplicate":{"post":{"operationId":"postProjectsByProjectIdPromotionsByPromotionIdDuplicate","tags":["Promotions"],"summary":"Duplicate a promotion","responses":{"201":{"description":"Promotion duplicated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Promotion not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"promotionId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"Name for the duplicated promotion","type":"string"},"changedBy":{"description":"Email of the user who made the change","type":"string"}}}}}}}},"/projects/{projectId}/categories":{"post":{"operationId":"postProjectsByProjectIdCategories","tags":["Catalog"],"summary":"Create a category","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":["string","null"]}},"required":["name"]}}}}},"get":{"operationId":"getProjectsByProjectIdCategories","tags":["Catalog"],"summary":"List categories","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}]}},"/projects/{projectId}/categories/{categoryId}":{"get":{"operationId":"getProjectsByProjectIdCategoriesByCategoryId","tags":["Catalog"],"summary":"Get a category","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"categoryId","schema":{"type":"string","minLength":1},"required":true}]},"put":{"operationId":"putProjectsByProjectIdCategoriesByCategoryId","tags":["Catalog"],"summary":"Update a category","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"categoryId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":["string","null"]}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdCategoriesByCategoryId","tags":["Catalog"],"summary":"Delete a category","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"400":{"description":"Category has products","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"categoryId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/products":{"post":{"operationId":"postProjectsByProjectIdProducts","tags":["Catalog"],"summary":"Create a product","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"price":{"type":"integer","minimum":0,"maximum":9007199254740991},"categoryIds":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"status":{"type":"string","enum":["active","inactive"]}},"required":["name","price"]}}}}},"get":{"operationId":"getProjectsByProjectIdProducts","tags":["Catalog"],"summary":"List products","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"in":"query","name":"categoryId","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string","enum":["active","inactive"]}}]}},"/projects/{projectId}/products/bulk":{"post":{"operationId":"postProjectsByProjectIdProductsBulk","tags":["Catalog"],"summary":"Bulk import products (max 1000)","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"products":{"minItems":1,"maxItems":1000,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"price":{"type":"integer","minimum":0,"maximum":9007199254740991},"categoryIds":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"status":{"type":"string","enum":["active","inactive"]}},"required":["name","price"]}}},"required":["products"]}}}}}},"/projects/{projectId}/products/{productId}":{"get":{"operationId":"getProjectsByProjectIdProductsByProductId","tags":["Catalog"],"summary":"Get a product","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"productId","schema":{"type":"string","minLength":1},"required":true}]},"put":{"operationId":"putProjectsByProjectIdProductsByProductId","tags":["Catalog"],"summary":"Update a product","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"productId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"price":{"type":"integer","minimum":0,"maximum":9007199254740991},"categoryIds":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"status":{"type":"string","enum":["active","inactive"]}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdProductsByProductId","tags":["Catalog"],"summary":"Delete a product","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"productId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/storage/tables":{"post":{"operationId":"postProjectsByProjectIdStorageTables","tags":["Storage"],"summary":"Create a custom table","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"description":{"type":"string"},"columns":{"minItems":1,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"type":{"type":"string","enum":["text","integer","real","boolean","json","datetime"]},"required":{"default":false,"type":"boolean"},"defaultValue":{"type":["string","number","boolean","null"]},"unique":{"type":"boolean"}},"required":["name","type"]}},"indexes":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"columns":{"minItems":1,"type":"array","items":{"type":"string","minLength":1}},"unique":{"type":"boolean"}},"required":["columns"]}}},"required":["name","columns"]}}}}},"get":{"operationId":"getProjectsByProjectIdStorageTables","tags":["Storage"],"summary":"List custom tables","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}]}},"/projects/{projectId}/storage/tables/{tableName}":{"get":{"operationId":"getProjectsByProjectIdStorageTablesByTableName","tags":["Storage"],"summary":"Get custom table schema","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Table not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"tableName","schema":{"type":"string","minLength":1},"required":true}]},"patch":{"operationId":"patchProjectsByProjectIdStorageTablesByTableName","tags":["Storage"],"summary":"Alter a custom table (add/remove/rename columns, manage indexes)","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Table not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"tableName","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"addColumns":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"type":{"type":"string","enum":["text","integer","real","boolean","json","datetime"]},"required":{"default":false,"type":"boolean"},"defaultValue":{"type":["string","number","boolean","null"]},"unique":{"type":"boolean"}},"required":["name","type"]}},"removeColumns":{"type":"array","items":{"type":"string"}},"renameColumns":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"]}},"addIndexes":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"columns":{"minItems":1,"type":"array","items":{"type":"string","minLength":1}},"unique":{"type":"boolean"}},"required":["columns"]}},"removeIndexes":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdStorageTablesByTableName","tags":["Storage"],"summary":"Drop a custom table","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"404":{"description":"Table not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"tableName","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/storage/tables/{tableName}/rows":{"post":{"operationId":"postProjectsByProjectIdStorageTablesByTableNameRows","tags":["Storage"],"summary":"Insert a row into a custom table","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"tableName","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1}},"required":["id"],"additionalProperties":{}}}}}}},"/projects/{projectId}/storage/tables/{tableName}/rows/bulk":{"post":{"operationId":"postProjectsByProjectIdStorageTablesByTableNameRowsBulk","tags":["Storage"],"summary":"Bulk insert rows into a custom table","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"tableName","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rows":{"minItems":1,"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1}},"required":["id"],"additionalProperties":{}}}},"required":["rows"]}}}}}},"/projects/{projectId}/storage/tables/{tableName}/rows/query":{"post":{"operationId":"postProjectsByProjectIdStorageTablesByTableNameRowsQuery","tags":["Storage"],"summary":"Query rows with filters, sorting, and pagination","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"tableName","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterGroup"},"sort":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"direction":{"default":"asc","type":"string","enum":["asc","desc"]}},"required":["field"]}},"select":{"type":"array","items":{"type":"string","minLength":1}},"limit":{"type":"integer","minimum":1,"maximum":10000},"offset":{"type":"integer","minimum":0,"maximum":9007199254740991}}}}}}}},"/projects/{projectId}/storage/tables/{tableName}/rows/{rowId}":{"get":{"operationId":"getProjectsByProjectIdStorageTablesByTableNameRowsByRowId","tags":["Storage"],"summary":"Get a row by ID","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Row not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"tableName","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"rowId","schema":{"type":"string","minLength":1},"required":true}]},"patch":{"operationId":"patchProjectsByProjectIdStorageTablesByTableNameRowsByRowId","tags":["Storage"],"summary":"Update a row","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Row not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"tableName","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"rowId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdStorageTablesByTableNameRowsByRowId","tags":["Storage"],"summary":"Delete a row","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"404":{"description":"Row not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"tableName","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"rowId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/storage/sql":{"post":{"operationId":"postProjectsByProjectIdStorageSql","tags":["Storage"],"summary":"Execute a read-only SQL query against custom tables","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sql":{"type":"string","minLength":1,"maxLength":10000},"maxRows":{"type":"integer","minimum":1,"maximum":10000}},"required":["sql"]}}}}}},"/projects/{projectId}/stores":{"post":{"operationId":"postProjectsByProjectIdStores","tags":["Stores"],"summary":"Create a store","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"imageUrl":{"type":["string","null"]},"status":{"type":"string","enum":["active","inactive","temporarily_closed"]},"countryCode":{"type":["string","null"]},"location":{"type":"object","properties":{"city":{"type":["string","null"]},"state":{"type":["string","null"]},"postalCode":{"type":["string","null"]},"lat":{"type":["number","null"]},"lng":{"type":["number","null"]},"formattedAddress":{"type":["string","null"]}}},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"managerId":{"type":["string","null"]},"workingHours":{"type":"object","properties":{"mon":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"tue":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"wed":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"thu":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"fri":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"sat":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"sun":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]}}},"facilityIds":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name"]}}}}},"get":{"operationId":"getProjectsByProjectIdStores","tags":["Stores"],"summary":"List stores","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"in":"query","name":"status","schema":{"type":"string","enum":["active","inactive","temporarily_closed"]}},{"in":"query","name":"countryCode","schema":{"type":"string"}}]}},"/projects/{projectId}/stores/{storeId}":{"get":{"operationId":"getProjectsByProjectIdStoresByStoreId","tags":["Stores"],"summary":"Get a store","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"storeId","schema":{"type":"string","minLength":1},"required":true}]},"put":{"operationId":"putProjectsByProjectIdStoresByStoreId","tags":["Stores"],"summary":"Update a store","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"storeId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"imageUrl":{"type":["string","null"]},"status":{"type":"string","enum":["active","inactive","temporarily_closed"]},"countryCode":{"type":["string","null"]},"location":{"type":"object","properties":{"city":{"type":["string","null"]},"state":{"type":["string","null"]},"postalCode":{"type":["string","null"]},"lat":{"type":["number","null"]},"lng":{"type":["number","null"]},"formattedAddress":{"type":["string","null"]}}},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"managerId":{"type":["string","null"]},"workingHours":{"type":"object","properties":{"mon":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"tue":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"wed":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"thu":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"fri":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"sat":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"sun":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]}}},"facilityIds":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdStoresByStoreId","tags":["Stores"],"summary":"Delete a store","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"storeId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/stores/import":{"post":{"operationId":"postProjectsByProjectIdStoresImport","tags":["Stores"],"summary":"Bulk import stores","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"stores":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"imageUrl":{"type":["string","null"]},"status":{"type":"string","enum":["active","inactive","temporarily_closed"]},"countryCode":{"type":["string","null"]},"location":{"type":"object","properties":{"city":{"type":["string","null"]},"state":{"type":["string","null"]},"postalCode":{"type":["string","null"]},"lat":{"type":["number","null"]},"lng":{"type":["number","null"]},"formattedAddress":{"type":["string","null"]}}},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"managerId":{"type":["string","null"]},"workingHours":{"type":"object","properties":{"mon":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"tue":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"wed":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"thu":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"fri":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"sat":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]},"sun":{"anyOf":[{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},{"type":"null"}]}}},"facilityIds":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name"]}}},"required":["stores"]}}}}}},"/projects/{projectId}/facilities":{"post":{"operationId":"postProjectsByProjectIdFacilities","tags":["Stores"],"summary":"Create a facility","responses":{"201":{"description":"Resource created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"icon":{"type":["string","null"]}},"required":["name"]}}}}},"get":{"operationId":"getProjectsByProjectIdFacilities","tags":["Stores"],"summary":"List facilities","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}]}},"/projects/{projectId}/facilities/{facilityId}":{"get":{"operationId":"getProjectsByProjectIdFacilitiesByFacilityId","tags":["Stores"],"summary":"Get a facility","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"facilityId","schema":{"type":"string","minLength":1},"required":true}]},"put":{"operationId":"putProjectsByProjectIdFacilitiesByFacilityId","tags":["Stores"],"summary":"Update a facility","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"facilityId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"icon":{"type":["string","null"]}}}}}}},"delete":{"operationId":"deleteProjectsByProjectIdFacilitiesByFacilityId","tags":["Stores"],"summary":"Delete a facility","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"facilityId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/facilities/{facilityId}/icon":{"put":{"operationId":"putProjectsByProjectIdFacilitiesByFacilityIdIcon","tags":["Stores"],"summary":"Upload a facility icon","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"facilityId","schema":{"type":"string","minLength":1},"required":true}]},"delete":{"operationId":"deleteProjectsByProjectIdFacilitiesByFacilityIdIcon","tags":["Stores"],"summary":"Delete a facility icon","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"facilityId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/stores/{storeId}/image":{"put":{"operationId":"putProjectsByProjectIdStoresByStoreIdImage","tags":["Stores"],"summary":"Upload a store image","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"storeId","schema":{"type":"string","minLength":1},"required":true}]},"delete":{"operationId":"deleteProjectsByProjectIdStoresByStoreIdImage","tags":["Stores"],"summary":"Delete a store image","responses":{"200":{"description":"Resource deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"]}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"in":"path","name":"projectId","schema":{"type":"string","minLength":1},"required":true},{"in":"path","name":"storeId","schema":{"type":"string","minLength":1},"required":true}]}},"/projects/{projectId}/tenant/status":{"get":{"operationId":"getProjectsByProjectIdTenantStatus","tags":["Tenant"],"summary":"Get tenant worker status","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"projectId","required":true}]}},"/projects/{projectId}/tenant/versions":{"get":{"operationId":"getProjectsByProjectIdTenantVersions","tags":["Tenant"],"summary":"List available tenant worker bundle versions","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"projectId","required":true}]}},"/projects/{projectId}/tenant/enable":{"post":{"operationId":"postProjectsByProjectIdTenantEnable","tags":["Tenant"],"summary":"Enable dispatch for project","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"projectId","required":true}]}},"/projects/{projectId}/tenant/disable":{"post":{"operationId":"postProjectsByProjectIdTenantDisable","tags":["Tenant"],"summary":"Disable dispatch for project","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"projectId","required":true}]}},"/projects/{projectId}/tenant/deploy":{"post":{"operationId":"postProjectsByProjectIdTenantDeploy","tags":["Tenant"],"summary":"Deploy or redeploy tenant worker","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Deployment failed","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"projectId","required":true}]}},"/projects/{projectId}/internal-tools":{"get":{"operationId":"getProjectsByProjectIdInternalTools","tags":["Internal Tools"],"summary":"List available internal tools","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"projectId","required":true}]}},"/projects/{projectId}/internal-tools/{toolName}/execute":{"post":{"operationId":"postProjectsByProjectIdInternalToolsByToolNameExecute","tags":["Internal Tools"],"summary":"Execute an internal tool","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{}},"required":["success","data"]}}}},"400":{"description":"Invalid JSON body","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Tool not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"500":{"description":"Execution error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"projectId","required":true},{"schema":{"type":"string"},"in":"path","name":"toolName","required":true}]}}}}