{
  "openapi": "3.1.0",
  "info": {
    "title": "Evaaluate API",
    "version": "1.0.0",
    "description": "Autonomous Statutory Valuation Platform API — built by ORIS Intelligence Pvt. Ltd.",
    "contact": { "name": "ORIS Support", "email": "support@evaaluate.com" }
  },
  "servers": [
    { "url": "https://evaaluate.com", "description": "Production" },
    { "url": "http://localhost:3000", "description": "Local Development" }
  ],
  "paths": {
    "/api/v1/health": {
      "get": {
        "summary": "Health Check",
        "tags": ["System"],
        "responses": {
          "200": { "description": "Healthy", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string" }, "database": { "type": "string" }, "timestamp": { "type": "string" } } } } } },
          "503": { "description": "Unhealthy" }
        }
      }
    },
    "/api/v1/engagements": {
      "get": {
        "summary": "List Engagements",
        "tags": ["Engagements"],
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "status", "in": "query", "schema": { "type": "string", "enum": ["CREATED", "DATA_INGESTING", "DATA_READY", "COMPUTING", "GATE_1", "GATE_2", "GATE_3", "COMPLETED", "FAILED"] } }],
        "responses": { "200": { "description": "List of engagements" }, "401": { "description": "Unauthorized" } }
      },
      "post": {
        "summary": "Create Engagement",
        "tags": ["Engagements"],
        "security": [{ "bearerAuth": [] }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["targetEntity", "statute"], "properties": { "targetEntity": { "type": "string", "minLength": 2 }, "cin": { "type": "string" }, "statute": { "type": "string", "enum": ["RULE_11UA", "COMPANIES_ACT_SEC_62", "FEMA_RBI", "IBC_LIQUIDATION"] } } } } } },
        "responses": { "201": { "description": "Engagement created" }, "400": { "description": "Validation error" }, "401": { "description": "Unauthorized" } }
      }
    },
    "/api/v1/engagements/{id}": {
      "get": {
        "summary": "Get Engagement",
        "tags": ["Engagements"],
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": { "200": { "description": "Engagement details" }, "404": { "description": "Not found" } }
      }
    },
    "/api/v1/engagements/{id}/assumptions": {
      "get": {
        "summary": "Get Assumptions",
        "tags": ["Assumptions"],
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": { "200": { "description": "Assumptions data" }, "404": { "description": "Not found" } }
      }
    },
    "/api/v1/engagements/{id}/assumptions/lock": {
      "post": {
        "summary": "Lock Assumptions",
        "tags": ["Assumptions"],
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["wacc", "terminalGrowthRate", "rationale"], "properties": { "wacc": { "type": "number", "minimum": 0.01, "maximum": 50 }, "terminalGrowthRate": { "type": "number", "minimum": 0, "maximum": 15 }, "rationale": { "type": "string", "minLength": 20 } } } } } },
        "responses": { "200": { "description": "Assumptions locked" }, "409": { "description": "Already locked" } }
      }
    },
    "/api/v1/engagements/{id}/report/status": {
      "get": {
        "summary": "Get Report Status",
        "tags": ["Reports"],
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": { "200": { "description": "Report status" } }
      }
    },
    "/api/v1/payments": {
      "post": {
        "summary": "Create Payment Order",
        "tags": ["Payments"],
        "security": [{ "bearerAuth": [] }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["engagementId"], "properties": { "engagementId": { "type": "string" } } } } } },
        "responses": { "200": { "description": "Razorpay order created" }, "409": { "description": "Already paid" } }
      },
      "get": {
        "summary": "List Payment History",
        "tags": ["Payments"],
        "security": [{ "bearerAuth": [] }],
        "responses": { "200": { "description": "Payment history" } }
      }
    },
    "/api/v1/payments/verify": {
      "post": {
        "summary": "Verify Payment",
        "tags": ["Payments"],
        "security": [{ "bearerAuth": [] }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["razorpay_order_id", "razorpay_payment_id", "razorpay_signature"], "properties": { "razorpay_order_id": { "type": "string" }, "razorpay_payment_id": { "type": "string" }, "razorpay_signature": { "type": "string" } } } } } },
        "responses": { "200": { "description": "Payment verified" }, "400": { "description": "Invalid signature" } }
      }
    },
    "/api/v1/team": {
      "get": {
        "summary": "List Team Members",
        "tags": ["Team"],
        "security": [{ "bearerAuth": [] }],
        "responses": { "200": { "description": "Team members list" } }
      }
    },
    "/api/v1/team/invite": {
      "post": {
        "summary": "Invite Team Member",
        "tags": ["Team"],
        "security": [{ "bearerAuth": [] }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["email", "name", "role"], "properties": { "email": { "type": "string", "format": "email" }, "name": { "type": "string" }, "role": { "type": "string", "enum": ["ADMIN", "VALUER", "VIEWER"] } } } } } },
        "responses": { "201": { "description": "Member invited" }, "403": { "description": "Insufficient permissions" }, "409": { "description": "Email already exists" } }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" }
    }
  }
}
