openapi: 3.1.0
info:
  title: Thai Notary Public — Service Catalogue & Agent API
  version: "1.1.0"
  description: |
    Read-only catalogue + interactive agent API for AI Agents
    (ChatGPT, Gemini, Perplexity, Claude, MCP clients).
  contact:
    name: ทนายโนตารี
    url: https://xn--m3cdga8bi5hd2a9j.com
    email: info@thainotary.co.th
servers:
  - url: https://xn--m3cdga8bi5hd2a9j.com
    description: Static catalogue pages
  - url: https://niwxaupggkqctydwrjfr.supabase.co/functions/v1/agent-api
    description: Agent API (live, public read-only)
paths:
  /sitemap.xml:
    get:
      operationId: getSitemap
      summary: Full URL inventory (~4,000 pages)
      responses:
        "200": { description: XML sitemap }
  /llms.txt:
    get:
      operationId: getLlmsCatalogue
      summary: Service catalogue + pricing for LLM consumption
      responses:
        "200": { description: Plain text }
  /llms-full.txt:
    get:
      operationId: getLlmsFullCatalogue
      summary: Extended catalogue with all services, locations, FAQs
      responses:
        "200": { description: Plain text }
  /pricing:
    get:
      operationId: getPricing
      summary: Master pricing table (THB)
      responses:
        "200": { description: HTML page with embedded JSON-LD Product schema }
  /contact:
    get:
      operationId: getContact
      summary: Contact channels (phone, LINE, hours)
      responses:
        "200": { description: HTML page }
  /naati-online:
    get:
      operationId: getNaatiOnlineHub
      summary: NAATI online translation hub — 25 countries
      responses:
        "200": { description: HTML page }
  /naati-online/{country}:
    get:
      operationId: getNaatiOnlineCountry
      summary: NAATI online price + ETA for specific destination country
      parameters:
        - in: path
          name: country
          schema: { type: string }
          required: true
          description: ISO-style slug (australia, new-zealand, united-kingdom, ...)
      responses:
        "200": { description: HTML page }
  /visa/out-thai/{country}:
    get:
      operationId: getVisaOutThai
      summary: Visa requirements for Thai passport to destination country
      parameters:
        - in: path
          name: country
          schema: { type: string }
          required: true
      responses:
        "200": { description: HTML page }
  /visa/in-thai/{nationality}:
    get:
      operationId: getVisaInThai
      summary: Visa for foreign nationals applying inside Thailand
      parameters:
        - in: path
          name: nationality
          schema: { type: string }
          required: true
      responses:
        "200": { description: HTML page }
  /services:
    servers:
      - url: https://niwxaupggkqctydwrjfr.supabase.co/functions/v1/agent-api
    get:
      operationId: listServices
      summary: List all 12 services with price range, timeline, and description
      responses:
        "200":
          description: JSON catalogue
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceList"
  /quote:
    servers:
      - url: https://niwxaupggkqctydwrjfr.supabase.co/functions/v1/agent-api
    post:
      operationId: getQuote
      summary: Get an indicative quote with shipping and a LINE deep link
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/QuoteRequest"
      responses:
        "200":
          description: Quote response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Quote"
        "400": { description: Validation error }
        "404": { description: Unknown service }
  /availability:
    servers:
      - url: https://niwxaupggkqctydwrjfr.supabase.co/functions/v1/agent-api
    get:
      operationId: getAvailability
      summary: Office hours + next available booking slot (Asia/Bangkok)
      responses:
        "200":
          description: Availability info
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Availability"
components:
  schemas:
    Service:
      type: object
      properties:
        slug: { type: string, example: notary }
        name: { type: string }
        name_th: { type: string }
        price_min_thb: { type: integer }
        price_max_thb: { type: integer }
        timeline_days: { type: string, example: "1-3" }
        description: { type: string }
        url: { type: string, format: uri }
    ServiceList:
      type: object
      properties:
        api: { type: string }
        version: { type: string }
        services:
          type: array
          items: { $ref: "#/components/schemas/Service" }
    QuoteRequest:
      type: object
      required: [service]
      properties:
        service:
          type: string
          enum: [notary, translation, background-check, consular, embassy, apostille, marriage, divorce, work-permit, naati, legal, immigration]
        document_type: { type: string, example: "Birth Certificate" }
        country: { type: string, example: "Australia" }
    Quote:
      type: object
      properties:
        service: { type: string }
        service_slug: { type: string }
        price_min_thb: { type: integer }
        price_max_thb: { type: integer }
        shipping_thb: { type: integer }
        total_min_thb: { type: integer }
        total_max_thb: { type: integer }
        currency: { type: string, example: THB }
        timeline_days: { type: string }
        line_url: { type: string, format: uri }
        phone: { type: string }
    Availability:
      type: object
      properties:
        timezone: { type: string }
        open_now: { type: boolean }
        current_time_bkk: { type: string }
        next_available_slot: { type: string }
