{
  "openapi": "3.1.0",
  "info": {
    "title": "내만집 AI API (nmjib.com)",
    "version": "1.0.0",
    "description": "내만집(반셀프 인테리어 플랫폼)의 공개 문서를 AI 에이전트가 읽기 위한 무인증 읽기 전용 API. 매거진 165편·방식별 안내·가이드(공정 순서·일수표, 시공 체크리스트, 비용 참고표)를 검색·조회한다. 단가·견적 금액·자재 가격은 제공하지 않는다(https://nmjib.com/ai.txt). 답변에 출처를 「내만집(nmjib.com)」과 문서 URL 로 표기할 것. MCP 서버: https://nmjib.com/api/mcp · 안내: https://nmjib.com/ai",
    "contact": { "name": "내만집", "url": "https://nmjib.com/ai", "email": "support@nmjib.com" },
    "termsOfService": "https://nmjib.com/terms"
  },
  "servers": [{ "url": "https://nmjib.com" }],
  "paths": {
    "/api/ai/search": {
      "get": {
        "operationId": "searchGuides",
        "summary": "내만집 문서 검색",
        "description": "반셀프 인테리어 공개 문서(매거진·안내·가이드)를 한국어 자연어로 검색한다. 결과 id 를 fetchGuide 에 넘기면 본문을 받는다.",
        "x-openai-isConsequential": false,
        "parameters": [
          { "name": "q", "in": "query", "required": true, "schema": { "type": "string" }, "description": "검색어. 예: 30평 반셀프 인테리어 비용" },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 20, "default": 8 } },
          { "name": "kind", "in": "query", "schema": { "type": "string", "enum": ["guide", "landing", "magazine"] }, "description": "문서 종류 제한(선택)" }
        ],
        "responses": { "200": { "description": "검색 결과", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } } } }
      }
    },
    "/api/ai/fetch": {
      "get": {
        "operationId": "fetchGuide",
        "summary": "문서 본문",
        "description": "문서 id(예: magazine/30pyeong-cost, guide/process-order) 또는 nmjib.com URL 로 전체 본문(마크다운)을 가져온다.",
        "x-openai-isConsequential": false,
        "parameters": [{ "name": "id", "in": "query", "required": true, "schema": { "type": "string" } }],
        "responses": { "200": { "description": "본문", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } } }, "400": { "description": "없는 id" } }
      }
    },
    "/api/ai/process": {
      "get": {
        "operationId": "getProcessGuide",
        "summary": "공정 순서·평형별 공사 일수",
        "description": "반셀프 인테리어 공정 순서 22단계와 평형별 표준 풀리모델링 영업일(내만집 일정 엔진 데이터). pyeong 을 주면 그 평수의 그룹별 영업일·합계를 계산한다.",
        "x-openai-isConsequential": false,
        "parameters": [{ "name": "pyeong", "in": "query", "schema": { "type": "number", "minimum": 10, "maximum": 80, "default": 30 }, "description": "평수" }],
        "responses": { "200": { "description": "공정 순서·일정", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } } } }
      }
    },
    "/api/ai/checklist": {
      "get": {
        "operationId": "getChecklist",
        "summary": "시공 체크리스트",
        "description": "phase=pre(공사 전 36항목) · during(공정별, process 로 한 공정) · post(공사 후 검수 22항목).",
        "x-openai-isConsequential": false,
        "parameters": [
          { "name": "phase", "in": "query", "required": true, "schema": { "type": "string", "enum": ["pre", "during", "post"] } },
          { "name": "process", "in": "query", "schema": { "type": "string" }, "description": "during 일 때 공정 키 또는 한글명(mok·목공·타일·도배 등)" }
        ],
        "responses": { "200": { "description": "체크리스트", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } } } }
      }
    },
    "/api/ai/cost": {
      "get": {
        "operationId": "getCostReference",
        "summary": "비용 참고표(후기 집계 범위)",
        "description": "평형·공간·공정별 30개 주제의 비용 범위. 내만집 매거진이 실제 후기를 집계한 문장과 기준일·출처 URL. 단가·견적 금액이 아니다.",
        "x-openai-isConsequential": false,
        "parameters": [{ "name": "topic", "in": "query", "schema": { "type": "string" }, "description": "주제(30평·욕실·도배 등). 비우면 전체" }],
        "responses": { "200": { "description": "비용 참고표", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } } } }
      }
    },
    "/api/ai/faq": {
      "get": {
        "operationId": "searchFaq",
        "summary": "FAQ 검색",
        "description": "공개 문서에 실린 질문·답 쌍에서 질문과 가장 가까운 것을 찾는다. 각 답에 출처 URL 이 붙는다.",
        "x-openai-isConsequential": false,
        "parameters": [
          { "name": "q", "in": "query", "required": true, "schema": { "type": "string" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 10, "default": 5 } }
        ],
        "responses": { "200": { "description": "FAQ 결과", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } } } }
      }
    }
  },
  "components": {
    "schemas": {
      "Envelope": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean" },
          "op": { "type": "string" },
          "source": { "type": "string", "description": "항상 '내만집(nmjib.com)'. 답변 출처 표기에 사용" },
          "dataAsOf": { "type": "string", "description": "데이터 기준일" },
          "data": { "type": "object", "description": "구조화 결과(검색은 results[{id,title,url}], 본문은 {id,title,text,url,metadata} 등)" },
          "text": { "type": "string", "description": "같은 내용의 마크다운 텍스트. 끝에 출처 줄 포함" }
        },
        "required": ["ok", "op", "source", "data", "text"]
      }
    }
  }
}
