{"openapi":"3.0.0","info":{"title":"Sales CRM API","version":"1.0.0","description":"API for managing contacts and sales deals in the CRM Hub."},"servers":[{"url":"http://localhost:4001","description":"Local Playground CRM API Server"}],"paths":{"/api/contacts":{"get":{"summary":"List all contacts","description":"Returns a list of all contacts and leads in the CRM.","operationId":"listContacts","responses":{"200":{"description":"A list of contacts.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}}}}}}},"post":{"summary":"Create a new contact","description":"Creates a new contact or lead in the CRM.","operationId":"createContact","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCreate"}}}},"responses":{"201":{"description":"Contact created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}}}}},"/api/contacts/{id}":{"patch":{"summary":"Update an existing contact","description":"Updates contact details like name, email, company, or status.","operationId":"updateContact","parameters":[{"name":"id","in":"path","required":true,"description":"The ID of the contact to update","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactUpdate"}}}},"responses":{"200":{"description":"Contact updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}}}},"delete":{"summary":"Delete a contact","description":"Deletes a contact from the CRM by ID.","operationId":"deleteContact","parameters":[{"name":"id","in":"path","required":true,"description":"The ID of the contact to delete","schema":{"type":"integer"}}],"responses":{"200":{"description":"Contact deleted successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}}}}},"/api/deals":{"get":{"summary":"List all deals","description":"Returns a list of all sales deals/opportunities in the CRM.","operationId":"listDeals","responses":{"200":{"description":"A list of deals.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Deal"}}}}}}},"post":{"summary":"Create a new deal","description":"Creates a new sales deal associated with a contact.","operationId":"createDeal","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealCreate"}}}},"responses":{"201":{"description":"Deal created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deal"}}}}}}},"/api/deals/{id}":{"patch":{"summary":"Update an existing deal","description":"Updates deal details like stage, value, or name.","operationId":"updateDeal","parameters":[{"name":"id","in":"path","required":true,"description":"The ID of the deal to update","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealUpdate"}}}},"responses":{"200":{"description":"Deal updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deal"}}}}}},"delete":{"summary":"Delete a deal","description":"Deletes a deal from the CRM by ID.","operationId":"deleteDeal","parameters":[{"name":"id","in":"path","required":true,"description":"The ID of the deal to delete","schema":{"type":"integer"}}],"responses":{"200":{"description":"Deal deleted successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}}}}}},"components":{"schemas":{"Contact":{"type":"object","properties":{"id":{"type":"integer","description":"Contact unique identifier"},"name":{"type":"string","description":"Full name of the contact"},"email":{"type":"string","description":"Email address"},"company":{"type":"string","description":"Company name"},"status":{"type":"string","enum":["lead","active","inactive"],"description":"Lifecycle status of the contact"}}},"ContactCreate":{"type":"object","required":["name","email"],"properties":{"name":{"type":"string","description":"Full name of the contact"},"email":{"type":"string","description":"Email address"},"company":{"type":"string","description":"Company name"},"status":{"type":"string","enum":["lead","active","inactive"],"default":"lead","description":"Lifecycle status of the contact"}}},"ContactUpdate":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"company":{"type":"string"},"status":{"type":"string","enum":["lead","active","inactive"]}}},"Deal":{"type":"object","properties":{"id":{"type":"integer","description":"Deal unique identifier"},"contact_id":{"type":"integer","description":"ID of the associated contact"},"name":{"type":"string","description":"Title/Name of the deal opportunity"},"value":{"type":"number","description":"Monetary value of the deal in USD"},"stage":{"type":"string","enum":["discovery","proposal","negotiation","won","lost"],"description":"Current pipeline stage of the deal"}}},"DealCreate":{"type":"object","required":["contact_id","name","value"],"properties":{"contact_id":{"type":"integer","description":"ID of the associated contact"},"name":{"type":"string","description":"Title/Name of the deal opportunity"},"value":{"type":"number","description":"Monetary value of the deal in USD"},"stage":{"type":"string","enum":["discovery","proposal","negotiation","won","lost"],"default":"discovery"}}},"DealUpdate":{"type":"object","properties":{"name":{"type":"string"},"value":{"type":"number"},"stage":{"type":"string","enum":["discovery","proposal","negotiation","won","lost"]}}}}}}