openapi: 3.0.0
info:
  title: HemmaBo Host API
  description: |
    API for vacation rental hosts to create and manage their own booking websites.
    
    ## What is HemmaBo?
    HemmaBo is white-label infrastructure that enables hosts to:
    - Create professional booking websites on custom domains
    - Accept direct bookings with 0% commission
    - Process payments directly via Stripe Connect
    - Sync availability with Airbnb/Booking.com via iCal
    
    ## Pricing
    399 SEK/month (~€35) per property. Custom domain included. No booking fees.
    
    ## Getting Started
    Sign up at https://hemmabo.se/auth to create your first property website.
  version: "1.0.0"
  contact:
    email: support@hemmabo.se
    url: https://hemmabo.se
servers:
  - url: https://nmrzgayimjnvnnlcffzl.supabase.co/functions/v1
    description: HemmaBo API
paths:
  /registry-search:
    get:
      operationId: searchProperties
      summary: Search vacation rental properties
      description: Search for vacation rentals in the HemmaBo network. Returns properties with direct booking URLs.
      parameters:
        - name: city
          in: query
          description: City name (e.g., "Stockholm", "Malmö")
          schema:
            type: string
        - name: region
          in: query
          description: Region/county (e.g., "Skåne", "Gotland")
          schema:
            type: string
        - name: min_guests
          in: query
          description: Minimum guest capacity
          schema:
            type: integer
        - name: max_price
          in: query
          description: Maximum price per night
          schema:
            type: number
        - name: amenities
          in: query
          description: Comma-separated amenities (pool, sauna, pet_friendly, etc.)
          schema:
            type: string
      responses:
        "200":
          description: List of matching properties
          content:
            application/json:
              schema:
                type: object
                properties:
                  properties:
                    type: array
                    items:
                      $ref: "#/components/schemas/PropertySummary"
  /ai-property-search:
    get:
      operationId: naturalLanguageSearch
      summary: Natural language property search
      description: Search for properties using natural language queries like "cabin with sauna near Stockholm for 6 people"
      parameters:
        - name: q
          in: query
          required: true
          description: Natural language search query
          schema:
            type: string
      responses:
        "200":
          description: Parsed search intent and matching properties
          content:
            application/json:
              schema:
                type: object
                properties:
                  parsed_intent:
                    type: object
                  properties:
                    type: array
                    items:
                      $ref: "#/components/schemas/PropertySummary"
  /mcp-booking:
    post:
      operationId: bookingActions
      summary: Property booking operations
      description: Check availability, get pricing, and create bookings for specific properties
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                action:
                  type: string
                  enum: [get_property, check_availability, get_pricing, create_booking]
                domain:
                  type: string
                  description: Property domain (e.g., "akerlyckan.se")
                check_in:
                  type: string
                  format: date
                check_out:
                  type: string
                  format: date
                guests:
                  type: integer
              required:
                - action
      responses:
        "200":
          description: Action result
          content:
            application/json:
              schema:
                type: object
components:
  schemas:
    PropertySummary:
      type: object
      properties:
        property_name:
          type: string
        direct_booking_url:
          type: string
        city:
          type: string
        region:
          type: string
        base_price_per_night:
          type: number
        currency:
          type: string
        max_guests:
          type: integer
        bedrooms:
          type: integer
        amenities:
          type: array
          items:
            type: string
