openapi: 3.1.0
info:
  title: Thai Notary Law Service — Agent API
  description: |
    Public, no-auth REST API for AI agents (ChatGPT, Gemini, Perplexity, Claude, Apple Intelligence)
    to look up services, pricing, and consultation availability for Thailand's leading
    Notary Public + certified translation + legalization firm.
  version: "1.0.0"
  contact:
    name: Thai Notary Law Service
    email: contact@thainotary.co.th
    url: https://thainotary.co.th
  license:
    name: Public read-only
    url: https://thainotary.co.th/legal/terms
servers:
  - url: https://xswibbuochcismgpgphl.supabase.co/functions/v1
    description: Production agent gateway
paths:
  /agent-services:
    get:
      operationId: listServices
      summary: List all 17 services with category, base price, and canonical URL
      responses:
        "200":
          description: List of services
          content:
            application/json:
              schema:
                type: object
                properties:
                  count: { type: integer }
                  services:
                    type: array
                    items: { $ref: "#/components/schemas/Service" }
  /agent-pricing:
    get:
      operationId: getPricing
      summary: Estimate price for a service
      parameters:
        - in: query
          name: service
          required: true
          schema: { type: string }
          example: naati-translation
        - in: query
          name: pages
          schema: { type: integer, minimum: 1, default: 1 }
        - in: query
          name: urgency
          schema:
            type: string
            enum: [standard, express, same-day]
            default: standard
      responses:
        "200":
          description: Pricing estimate
          content:
            application/json:
              schema: { $ref: "#/components/schemas/PricingEstimate" }
        "400":
          description: Invalid service key
  /agent-availability:
    get:
      operationId: checkAvailability
      summary: Check open consultation slots
      parameters:
        - in: query
          name: days
          schema: { type: integer, minimum: 1, maximum: 30, default: 7 }
        - in: query
          name: branch
          schema:
            type: string
            enum: [bangkok-hq, chiangmai, phuket, online]
            default: bangkok-hq
      responses:
        "200":
          description: Availability map
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Availability" }
components:
  schemas:
    Service:
      type: object
      properties:
        key: { type: string }
        name_th: { type: string }
        name_en: { type: string }
        category: { type: string }
        price_from_thb: { type: number }
        currency: { type: string, default: THB }
        url: { type: string, format: uri }
        languages: { type: array, items: { type: string } }
    PricingEstimate:
      type: object
      properties:
        service: { type: string }
        pages: { type: integer }
        urgency: { type: string }
        total_thb: { type: number }
        breakdown:
          type: array
          items:
            type: object
            properties:
              label: { type: string }
              amount_thb: { type: number }
        notes_th: { type: string }
        notes_en: { type: string }
        booking_url: { type: string, format: uri }
    Availability:
      type: object
      properties:
        branch: { type: string }
        timezone: { type: string, default: Asia/Bangkok }
        slots:
          type: array
          items:
            type: object
            properties:
              date: { type: string, format: date }
              open_slots: { type: integer }
              hours: { type: string, example: "09:00–18:00" }
