﻿version: "2"
assistant:
  language: auto
  timezone: Asia/Hebron
tools:
  - id: availability
    tool:
      description: Find available appointment times for a date. This tool does not create a booking.
      input_schema:
        type: object
        properties:
          date: { type: string, format: date }
        required: [date]
    request:
      method: GET
      url: https://api.example.com/availability
      map:
        query:
          date: $.date
    response:
      private_fields: [slot_token]
      output_schema:
        type: object
        properties:
          slots:
            type: array
            items:
              type: object
              properties:
                slot_token: { type: string }
                label: { type: string }
              required: [slot_token, label]
        required: [slots]

  - id: book
    tool:
      description: Book an appointment for a date after selecting an available time and confirming.
      input_schema:
        type: object
        properties:
          date: { type: string, format: date }
          slot_token: { type: string, minLength: 1 }
          notes: { type: string, maxLength: 500 }
        required: [date, slot_token]
    depends_on:
      - tool: availability
        when: always
        arguments:
          date: $.date
        select:
          items_path: $.slots
          id_path: $.slot_token
          label_path: $.label
          id_sensitive: true
          facts:
            time: $.label
        map:
          $.slot_token: $.slot_token
        ttl_ms: 30000
    behavior:
      effect: side-effect
      confirmation:
        required: true
        ttl_ms: 30000
        preview:
          date: $.date
          time: { source: selection, path: $.time }
          notes: $.notes
      recovery:
        refresh_dependency: availability
        statuses: [409, 410]
    request:
      method: POST
      url: https://api.example.com/bookings
      auth:
        type: session
      retry:
        attempts: 1
      map:
        body:
          date: $.date
          slot_token: $.slot_token
          notes: $.notes

