{"openapi":"3.0.0","info":{"title":"CB Project Management System API","version":"1.0.0","description":"Comprehensive REST API documentation for Chatbot Solutions Project Management System, Server & Credentials Vault, Expiry Tracking, and Team Operations.","contact":{"name":"Chatbot Solutions Pvt. Ltd.","email":"info@chatbotsolutions.in","url":"https://chatbotsolutions.in"}},"servers":[{"url":"http://localhost:7000","description":"Local Development Server"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"LoginRequest":{"type":"object","required":["phone","password"],"properties":{"phone":{"type":"string","example":"9876543210"},"password":{"type":"string","example":"Admin@123"}}},"TeamMember":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Bishnu Prasad"},"phone":{"type":"string","example":"9876543210"},"email":{"type":"string","example":"admin@chatbotsolutions.in"},"designation":{"type":"string","example":"Project Lead & Admin"},"role":{"type":"string","enum":["admin","manager","developer","designer","member"],"example":"admin"},"is_active":{"type":"integer","example":1}}},"Project":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Corporate Portal"},"industry":{"type":"string","example":"Technology"},"type":{"type":"string","enum":["static","partial_dynamic","dynamic"],"example":"dynamic"},"priority":{"type":"string","enum":["low","medium","high","urgent"],"example":"high"},"status":{"type":"string","enum":["draft","in progress","modifying","completed","on hold"],"example":"in progress"},"manager":{"type":"string","example":"Bishnu Prasad"},"team_size":{"type":"integer","example":4},"technology":{"type":"string","example":"React, Node.js, MySQL"}}},"Server":{"type":"object","properties":{"id":{"type":"integer","example":1},"server_name":{"type":"string","example":"WHM Main Production Server"},"server_url":{"type":"string","example":"192.185.129.222/cpanel"},"username":{"type":"string","example":"cpanel_admin"},"password":{"type":"string","example":"S3cur3P@ssw0rd!"},"service_provider_id":{"type":"integer","example":6},"service_provider_name":{"type":"string","example":"GoDaddy"},"is_active":{"type":"integer","example":1},"domain_count":{"type":"integer","example":12}}},"Domain":{"type":"object","properties":{"id":{"type":"integer","example":1},"domain_name":{"type":"string","example":"chatbotsolutions.in"},"server_id":{"type":"integer","example":4},"service_provider_id":{"type":"integer","example":6},"start_date":{"type":"string","format":"date","example":"2025-01-01"},"expiry_date":{"type":"string","format":"date","example":"2027-01-01"},"ssl_expiry_dt":{"type":"string","format":"date","example":"2026-12-15"}}},"Client":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Acme Corporation"},"client_type":{"type":"string","enum":["project","product"],"example":"project"},"email":{"type":"string","example":"contact@acme.com"},"phone":{"type":"string","example":"+91 9876543210"},"country":{"type":"string","example":"India"},"gst":{"type":"string","example":"21AAAAA0000A1Z5"},"is_active":{"type":"integer","example":1}}}}},"tags":[{"name":"Authentication & Team","description":"Team login, profile, and member management"},{"name":"Projects","description":"Client project management and statistics"},{"name":"Servers & Credentials Vault","description":"cPanel/WHM/Cloud host credentials and passwords"},{"name":"Domains","description":"Domain names, server associations, and SSL tracking"},{"name":"Expiry Watch","description":"Urgent domain, email, and SSL expirations & renewal"},{"name":"Clients","description":"Client directory and project assignments"},{"name":"Service Providers","description":"Hosting providers and domain registrars"},{"name":"Notifications","description":"System alerts and renewal notifications"},{"name":"Orders & Quotations","description":"Quotations, product items, and invoices"},{"name":"Quotations","description":"Commercial proposals, line-item estimates, and approval workflows"},{"name":"Minutes of Meeting (MOM)","description":"Meeting agendas, attendees, and action items"},{"name":"Project Documents","description":"File uploads and project attachments"},{"name":"Project Reports","description":"Analytical reports and Excel exports"},{"name":"Digital Marketing","description":"Marketing campaigns (SEO, SMO, Ads) and budgets"},{"name":"Pipelines","description":"Opportunity pipeline, client discussions, negotiation, and project conversion"}],"paths":{"/api/team/login":{"post":{"tags":["Authentication & Team"],"summary":"Login team member by mobile number and password","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}}},"responses":{"200":{"description":"Login successful with JWT token and user profile"},"401":{"description":"Invalid mobile number or password"},"403":{"description":"Account deactivated"}}}},"/api/team/profile/{id}":{"get":{"tags":["Authentication & Team"],"summary":"Get team member profile by ID","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"User profile data"},"404":{"description":"Team member not found"}}}},"/api/team":{"get":{"tags":["Authentication & Team"],"summary":"List all active team members","parameters":[{"name":"search","in":"query","schema":{"type":"string"},"description":"Search by name, phone, email, designation"},{"name":"role","in":"query","schema":{"type":"string"},"description":"Filter by role (admin, manager, developer, designer, member)"},{"name":"status","in":"query","schema":{"type":"string","enum":["active","inactive"]}}],"responses":{"200":{"description":"Array of team members"}}},"post":{"tags":["Authentication & Team"],"summary":"Create a new team member","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","phone","password"],"properties":{"name":{"type":"string"},"phone":{"type":"string"},"password":{"type":"string"},"email":{"type":"string"},"designation":{"type":"string"},"role":{"type":"string","enum":["admin","manager","developer","designer","member"]}}}}}},"responses":{"201":{"description":"Team member created"},"400":{"description":"Validation error or duplicate phone/email"}}}},"/api/team/{id}":{"get":{"tags":["Authentication & Team"],"summary":"Get team member details by ID","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Team member details"}}},"put":{"tags":["Authentication & Team"],"summary":"Update team member details","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"designation":{"type":"string"},"role":{"type":"string"},"password":{"type":"string"}}}}}},"responses":{"200":{"description":"Updated successfully"}}},"delete":{"tags":["Authentication & Team"],"summary":"Soft delete a team member","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Deleted successfully"}}}},"/api/team/toggle/{id}":{"put":{"tags":["Authentication & Team"],"summary":"Toggle active/inactive status of team member","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Status toggled"}}}},"/api/projects":{"get":{"tags":["Projects"],"summary":"List all projects with filtering and pagination","parameters":[{"name":"search","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"industry","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":10}}],"responses":{"200":{"description":"List of projects"}}},"post":{"tags":["Projects"],"summary":"Create a project with transaction (domain and clients)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["project"],"properties":{"project":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"industry":{"type":"string"},"type":{"type":"string","enum":["static","partial_dynamic","dynamic"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"status":{"type":"string"},"manager":{"type":"string"},"team_size":{"type":"integer"},"technology":{"type":"string"}}},"domain":{"type":"object"},"clients":{"type":"array","items":{"type":"integer"}}}}}}},"responses":{"201":{"description":"Project created"}}}},"/api/projects/stats":{"get":{"tags":["Projects"],"summary":"Get overall KPI statistics for dashboard","responses":{"200":{"description":"Total projects, in-progress, Indian vs foreign clients, and urgent expiries"}}}},"/api/projects/industries":{"get":{"tags":["Projects"],"summary":"Get list of distinct project industries","responses":{"200":{"description":"Array of industry names"}}}},"/api/projects/{id}":{"get":{"tags":["Projects"],"summary":"Get full project details with domain, clients, and emails","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Project details"}}},"put":{"tags":["Projects"],"summary":"Update project information","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Project updated"}}},"delete":{"tags":["Projects"],"summary":"Soft delete a project","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Project deleted"}}}},"/api/projects/toggle/{id}":{"put":{"tags":["Projects"],"summary":"Toggle project active/inactive status","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Project status toggled"}}}},"/api/servers":{"get":{"tags":["Servers & Credentials Vault"],"summary":"Get all server hosts with credentials and domain counts","parameters":[{"name":"search","in":"query","schema":{"type":"string"}},{"name":"provider","in":"query","schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"List of servers with credentials"}}},"post":{"tags":["Servers & Credentials Vault"],"summary":"Add a new server with access credentials","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["server_name"],"properties":{"server_name":{"type":"string"},"server_url":{"type":"string"},"username":{"type":"string"},"password":{"type":"string"},"service_provider_id":{"type":"integer"}}}}}},"responses":{"201":{"description":"Server created"}}}},"/api/servers/{id}":{"get":{"tags":["Servers & Credentials Vault"],"summary":"Get server credentials by ID","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Server credentials"}}},"put":{"tags":["Servers & Credentials Vault"],"summary":"Update server credentials","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Server updated"}}},"delete":{"tags":["Servers & Credentials Vault"],"summary":"Soft delete a server","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Server deleted"}}}},"/api/servers/toggle/{id}":{"put":{"tags":["Servers & Credentials Vault"],"summary":"Toggle server active/inactive status","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Server status toggled"}}}},"/api/servers/by-provider/{id}":{"get":{"tags":["Servers & Credentials Vault"],"summary":"Get servers hosted on a given service provider","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"List of servers"}}}},"/api/domains":{"get":{"tags":["Domains"],"summary":"List all domains","responses":{"200":{"description":"Array of domains"}}},"post":{"tags":["Domains"],"summary":"Create a domain record","responses":{"201":{"description":"Domain created"}}}},"/api/domains/server":{"get":{"tags":["Domains"],"summary":"Get domains grouped by server","responses":{"200":{"description":"Domains list"}}}},"/api/domains/project/{projectId}":{"get":{"tags":["Domains"],"summary":"Get domain belonging to a project","parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Project domain"}}}},"/api/expiry":{"get":{"tags":["Expiry Watch"],"summary":"Get urgent and expired domains, SSL certificates, and emails","parameters":[{"name":"search","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"type":"string","enum":["all","domain","email","ssl"]}},{"name":"page","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Urgent expiry list with days left and summary count"}}}},"/api/expiry/renew":{"put":{"tags":["Expiry Watch"],"summary":"Renew domain, email, or SSL expiry date","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","ref_id","new_date"],"properties":{"type":{"type":"string","enum":["Domain","Email","SSL"]},"ref_id":{"type":"integer"},"new_date":{"type":"string","format":"date","example":"2027-02-15"}}}}}},"responses":{"200":{"description":"Expiry renewed successfully"}}}},"/api/clients":{"get":{"tags":["Clients"],"summary":"Get clients with pagination and filters","parameters":[{"name":"search","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"type":"string","enum":["project","product"]}},{"name":"country","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Clients list"}}},"post":{"tags":["Clients"],"summary":"Create a new client","responses":{"201":{"description":"Client created"}}}},"/api/clients/clients":{"get":{"tags":["Clients"],"summary":"Get lightweight client selector list","responses":{"200":{"description":"Client list"}}}},"/api/clients/{id}":{"get":{"tags":["Clients"],"summary":"Get single client details","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Client details"}}},"put":{"tags":["Clients"],"summary":"Update client details","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Client updated"}}},"delete":{"tags":["Clients"],"summary":"Delete client","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Client deleted"}}}},"/api/clients/{id}/projects":{"get":{"tags":["Clients"],"summary":"Get all projects belonging to a client","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Client projects list"}}}},"/api/service-providers":{"get":{"tags":["Service Providers"],"summary":"List all domain registrars and hosting service providers","responses":{"200":{"description":"List of service providers"}}},"post":{"tags":["Service Providers"],"summary":"Add a service provider (e.g. AWS, GoDaddy, Hostinger)","responses":{"201":{"description":"Service provider created"}}}},"/api/service-providers/{id}":{"get":{"tags":["Service Providers"],"summary":"Get service provider by ID","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Service provider details"}}},"put":{"tags":["Service Providers"],"summary":"Update service provider","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Updated"}}},"delete":{"tags":["Service Providers"],"summary":"Delete service provider","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Deleted"}}}},"/api/notifications":{"get":{"tags":["Notifications"],"summary":"Get all notifications","responses":{"200":{"description":"List of notifications"}}}},"/api/notifications/count":{"get":{"tags":["Notifications"],"summary":"Get unread notification count","responses":{"200":{"description":"Count of unread notifications"}}}},"/api/notifications/read/{id}":{"put":{"tags":["Notifications"],"summary":"Mark notification as read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Marked as read"}}}},"/api/notifications/read-all":{"put":{"tags":["Notifications"],"summary":"Mark all notifications as read","responses":{"200":{"description":"All marked as read"}}}},"/api/orders/dashboard":{"get":{"tags":["Orders & Quotations"],"summary":"Get orders and quotation dashboard overview","responses":{"200":{"description":"Order metrics"}}}},"/api/orders":{"get":{"tags":["Orders & Quotations"],"summary":"List all orders","responses":{"200":{"description":"List of orders"}}},"post":{"tags":["Orders & Quotations"],"summary":"Create a new quotation/order","responses":{"201":{"description":"Order created"}}}},"/api/orders/{id}":{"get":{"tags":["Orders & Quotations"],"summary":"Get full order details with product items and invoices","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Order details"}}},"delete":{"tags":["Orders & Quotations"],"summary":"Delete an order","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Deleted"}}}},"/api/project_mom":{"get":{"tags":["Minutes of Meeting (MOM)"],"summary":"Get all MOM meeting records","responses":{"200":{"description":"List of MOM meetings"}}}},"/api/project_mom/create":{"post":{"tags":["Minutes of Meeting (MOM)"],"summary":"Create a new project meeting record with agenda and action items","responses":{"201":{"description":"MOM created"}}}},"/api/project_mom/project/{project_id}":{"get":{"tags":["Minutes of Meeting (MOM)"],"summary":"Get MOM meetings for a specific project","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Project MOM list"}}}},"/api/mom_attendees":{"get":{"tags":["Minutes of Meeting (MOM)"],"summary":"Get master list of meeting attendees","responses":{"200":{"description":"Attendees list"}}},"post":{"tags":["Minutes of Meeting (MOM)"],"summary":"Create a meeting attendee","responses":{"201":{"description":"Attendee created"}}}},"/api/project-documents/project/{projectId}":{"get":{"tags":["Project Documents"],"summary":"Get all uploaded documents for a project","parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Project documents"}}}},"/api/project-documents/documenttypes":{"get":{"tags":["Project Documents"],"summary":"Get list of document types (e.g. Contract, Proposal, SRS)","responses":{"200":{"description":"Document types"}}}},"/api/project-reports/reports":{"get":{"tags":["Project Reports"],"summary":"Generate project reports data","responses":{"200":{"description":"Report data"}}}},"/api/project-reports/export":{"get":{"tags":["Project Reports"],"summary":"Export project report to Excel (.xlsx)","responses":{"200":{"description":"Excel binary file"}}}},"/api/marketing":{"get":{"tags":["Digital Marketing"],"summary":"List digital marketing campaigns and budgets","responses":{"200":{"description":"Marketing campaigns"}}},"post":{"tags":["Digital Marketing"],"summary":"Create digital marketing module","responses":{"201":{"description":"Created"}}}},"/api/quotations/stats":{"get":{"tags":["Quotations"],"summary":"Get Quotations overview metrics and pipeline statistics","responses":{"200":{"description":"Quotation statistics (totalQuotations, totalValue, sentCount, acceptedCount, draftCount, rejectedCount)"}}}},"/api/quotations":{"get":{"tags":["Quotations"],"summary":"List all quotations with search, status/type filters, and pagination","parameters":[{"name":"search","in":"query","schema":{"type":"string"},"description":"Filter by quotation number, subject, or client name"},{"name":"type","in":"query","schema":{"type":"string","enum":["project","domain","product"]},"description":"Filter by quotation category"},{"name":"status","in":"query","schema":{"type":"string","enum":["draft","sent","accepted","rejected","expired"]},"description":"Filter by approval status"},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":10}}],"responses":{"200":{"description":"Paginated list of quotations"}}},"post":{"tags":["Quotations"],"summary":"Create a new quotation proposal with line items","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["client_id","subject","items"],"properties":{"client_id":{"type":"integer","example":2},"quotation_type":{"type":"string","enum":["project","domain","product"],"default":"project"},"quotation_date":{"type":"string","format":"date","example":"2026-10-27"},"valid_until":{"type":"string","format":"date","example":"2026-11-27"},"subject":{"type":"string","example":"Enterprise E-commerce Platform"},"discount_amount":{"type":"number","example":5000},"tax_rate":{"type":"number","example":18},"terms_conditions":{"type":"string","example":"50% advance, 50% upon delivery."},"notes":{"type":"string","example":"Includes 1 year maintenance"},"items":{"type":"array","items":{"type":"object","required":["description","quantity","unit_price"],"properties":{"description":{"type":"string","example":"Next.js Web Portal"},"quantity":{"type":"number","example":1},"unit_price":{"type":"number","example":80000},"item_type":{"type":"string","example":"service"}}}}}}}}},"responses":{"201":{"description":"Quotation created successfully"}}}},"/api/quotations/{id}":{"get":{"tags":["Quotations"],"summary":"Get single quotation with line items and client details","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Full quotation details"},"404":{"description":"Quotation not found"}}},"put":{"tags":["Quotations"],"summary":"Update existing quotation and line items","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"client_id":{"type":"integer"},"quotation_type":{"type":"string","enum":["project","domain","product"]},"quotation_date":{"type":"string","format":"date"},"valid_until":{"type":"string","format":"date"},"subject":{"type":"string"},"discount_amount":{"type":"number"},"tax_rate":{"type":"number"},"terms_conditions":{"type":"string"},"notes":{"type":"string"},"items":{"type":"array"}}}}}},"responses":{"200":{"description":"Quotation updated successfully"}}},"delete":{"tags":["Quotations"],"summary":"Soft delete a quotation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Quotation deleted"}}}},"/api/quotations/status/{id}":{"put":{"tags":["Quotations"],"summary":"Quick update quotation status (draft, sent, accepted, rejected, expired)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["draft","sent","accepted","rejected","expired"],"example":"accepted"}}}}}},"responses":{"200":{"description":"Status updated successfully"}}}},"/api/pipelines/stats":{"get":{"tags":["Pipelines"],"summary":"Get Pipeline dashboard KPIs and stage breakdown","responses":{"200":{"description":"Pipeline statistics"}}}},"/api/pipelines":{"get":{"tags":["Pipelines"],"summary":"List all pipelines with filtering and pagination","parameters":[{"name":"search","in":"query","schema":{"type":"string"}},{"name":"stage","in":"query","schema":{"type":"string"}},{"name":"priority","in":"query","schema":{"type":"string"}},{"name":"client_id","in":"query","schema":{"type":"integer"}},{"name":"assigned_to","in":"query","schema":{"type":"integer"}},{"name":"followup_status","in":"query","schema":{"type":"string","enum":["overdue","today","upcoming","none"]}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":15}}],"responses":{"200":{"description":"Paginated list of pipelines"}}},"post":{"tags":["Pipelines"],"summary":"Create a new pipeline opportunity","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title","client_id"],"properties":{"title":{"type":"string","example":"Enterprise Cloud ERP Platform"},"client_id":{"type":"integer","example":1},"contact_person":{"type":"string","example":"Dr. Sharma"},"contact_email":{"type":"string","example":"sharma@example.com"},"contact_mobile":{"type":"string","example":"9876543210"},"description":{"type":"string"},"requirement_details":{"type":"string"},"stage":{"type":"string","enum":["initial_discussion","requirement_gathering","quotation_preparation","quotation_sent","negotiation","pending_client_approval","won","lost","on_hold"],"default":"initial_discussion"},"priority":{"type":"string","enum":["low","medium","high","urgent"],"default":"medium"},"assigned_to":{"type":"integer"},"estimated_budget":{"type":"number","example":250000},"expected_closing_date":{"type":"string","format":"date"},"discussion_date":{"type":"string","format":"date"},"initial_discussion_details":{"type":"string"},"next_followup_date":{"type":"string","format":"date"}}}}}},"responses":{"201":{"description":"Pipeline created successfully"}}}},"/api/pipelines/{id}":{"get":{"tags":["Pipelines"],"summary":"Get single pipeline details with discussions and quotations","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Pipeline details"}}},"put":{"tags":["Pipelines"],"summary":"Update pipeline parameters","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Pipeline updated"}}},"delete":{"tags":["Pipelines"],"summary":"Soft delete a pipeline","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Pipeline deleted"}}}},"/api/pipelines/stage/{id}":{"put":{"tags":["Pipelines"],"summary":"Update pipeline stage (and record transition discussion log)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["stage"],"properties":{"stage":{"type":"string","enum":["initial_discussion","requirement_gathering","quotation_preparation","quotation_sent","negotiation","pending_client_approval","won","lost","on_hold"]},"lost_reason":{"type":"string"}}}}}},"responses":{"200":{"description":"Stage updated successfully"}}}},"/api/pipelines/discussion/{id}":{"post":{"tags":["Pipelines"],"summary":"Add a discussion or follow-up note to pipeline timeline","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["subject","discussion_details"],"properties":{"discussion_date":{"type":"string","format":"date"},"discussion_type":{"type":"string","enum":["meeting","call","email","whatsapp","site_visit","other"]},"subject":{"type":"string"},"discussion_details":{"type":"string"},"outcome":{"type":"string"},"next_action":{"type":"string"},"next_followup_date":{"type":"string","format":"date"}}}}}},"responses":{"201":{"description":"Discussion recorded successfully"}}}},"/api/pipelines/link-quotation/{id}":{"post":{"tags":["Pipelines"],"summary":"Link an existing quotation to this pipeline","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["quotation_id"],"properties":{"quotation_id":{"type":"integer"}}}}}},"responses":{"200":{"description":"Quotation linked successfully"}}}},"/api/pipelines/convert/{id}":{"post":{"tags":["Pipelines"],"summary":"Convert Won pipeline into an active Project (Atomic Handover)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Project name (defaults to pipeline title)"},"industry":{"type":"string"},"type":{"type":"string","enum":["static","partial_dynamic","dynamic"]},"priority":{"type":"string"},"technology":{"type":"string"},"manager":{"type":"string"},"team_size":{"type":"integer"},"start_dt":{"type":"string","format":"date"}}}}}},"responses":{"200":{"description":"Converted to Project successfully, returns new projectId"},"400":{"description":"Validation error (e.g. not Won, already converted, or duplicate project name)"}}}},"/api/phases/stats":{"get":{"tags":["Development Phases"],"summary":"Get Development Phase dashboard KPIs","parameters":[{"name":"project_id","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Dashboard statistics returned successfully"}}}},"/api/phases/masters":{"get":{"tags":["Development Phases"],"summary":"Get reusable Phase Master catalog","parameters":[{"name":"search","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Phase masters list"}}},"post":{"tags":["Development Phases"],"summary":"Create new Phase Master definition","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["phase_code","phase_name"],"properties":{"phase_code":{"type":"string","example":"SEC_AUDIT"},"phase_name":{"type":"string","example":"Security Audit & Hardening"},"description":{"type":"string"},"default_duration_days":{"type":"integer","example":5},"default_order":{"type":"integer","example":11}}}}}},"responses":{"201":{"description":"Phase master created"}}}},"/api/phases/templates":{"get":{"tags":["Development Phases"],"summary":"Get phase templates with ordered items","responses":{"200":{"description":"Templates list"}}},"post":{"tags":["Development Phases"],"summary":"Create a phase template","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["template_name","template_code","items"],"properties":{"template_name":{"type":"string"},"template_code":{"type":"string"},"description":{"type":"string"},"items":{"type":"array","items":{"type":"object"}}}}}}},"responses":{"201":{"description":"Template created"}}}},"/api/phases/project/{projectId}":{"get":{"tags":["Development Phases"],"summary":"Get all phases for a project with overall progress","parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Project phases and metrics"}}},"post":{"tags":["Development Phases"],"summary":"Add a manual phase to a project","parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["phase_name"],"properties":{"phase_name":{"type":"string"},"phase_description":{"type":"string"},"assigned_to":{"type":"integer"},"planned_start_date":{"type":"string","format":"date"},"planned_end_date":{"type":"string","format":"date"},"priority":{"type":"string","enum":["low","medium","high","urgent"]}}}}}},"responses":{"201":{"description":"Phase added to project"}}}},"/api/phases/project/{projectId}/apply-template":{"post":{"tags":["Development Phases"],"summary":"Generate phases for a project from a reusable template","parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["template_id"],"properties":{"template_id":{"type":"integer"},"start_date":{"type":"string","format":"date"},"assigned_to":{"type":"integer"},"append":{"type":"boolean"}}}}}},"responses":{"201":{"description":"Phases generated successfully"}}}},"/api/phases/project/{projectId}/reorder":{"put":{"tags":["Development Phases"],"summary":"Reorder sequence of phases in a project","parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["phase_ids"],"properties":{"phase_ids":{"type":"array","items":{"type":"integer"}}}}}}},"responses":{"200":{"description":"Phases reordered successfully"}}}},"/api/phases":{"get":{"tags":["Development Phases"],"summary":"Get cross-project list of phases with filters","parameters":[{"name":"search","in":"query","schema":{"type":"string"}},{"name":"project_id","in":"query","schema":{"type":"integer"}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"priority","in":"query","schema":{"type":"string"}},{"name":"overdue_only","in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Phases list"}}}},"/api/phases/{id}":{"get":{"tags":["Development Phases"],"summary":"Get single phase details with history","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Phase details"}}},"put":{"tags":["Development Phases"],"summary":"Update phase details","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Phase updated"}}},"delete":{"tags":["Development Phases"],"summary":"Soft delete a phase","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Phase deleted"}}}},"/api/phases/{id}/status":{"put":{"tags":["Development Phases"],"summary":"Transition phase lifecycle status","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["not_started","ready","in_progress","on_hold","blocked","completed","cancelled"]},"reason":{"type":"string"},"override_dependency":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Status transitioned"}}}},"/api/phases/{id}/progress":{"put":{"tags":["Development Phases"],"summary":"Update phase progress percentage (0-100%)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["progress"],"properties":{"progress":{"type":"integer","minimum":0,"maximum":100},"note":{"type":"string"}}}}}},"responses":{"200":{"description":"Progress updated"}}}},"/api/phases/{id}/history":{"get":{"tags":["Development Phases"],"summary":"Get chronological audit history for a phase","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Phase audit history"}}}},"/api/phases/overdue":{"get":{"tags":["Development Phases"],"summary":"List all overdue phases","responses":{"200":{"description":"Overdue phases"}}}},"/api/phases/upcoming":{"get":{"tags":["Development Phases"],"summary":"List phases approaching deadlines within N days","parameters":[{"name":"days","in":"query","schema":{"type":"integer","default":7}}],"responses":{"200":{"description":"Upcoming phases"}}}}}}