import { AcuityClient } from '../clients/acuity.js';

export const availabilityTools = [
  {
    name: 'acuity_get_availability_dates',
    description: 'Get available dates for an appointment type in a given month',
    inputSchema: {
      type: 'object',
      properties: {
        appointmentTypeID: {
          type: 'number',
          description: 'Appointment Type ID',
        },
        month: {
          type: 'string',
          description: 'Month in YYYY-MM format',
        },
        calendarID: {
          type: 'number',
          description: 'Optional calendar ID filter',
        },
        timezone: {
          type: 'string',
          description: 'Timezone (e.g., America/New_York)',
        },
      },
      required: ['appointmentTypeID', 'month'],
    },
    handler: async (args: any, client: AcuityClient) => {
      const availability = await client.getAvailability(args);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(availability, null, 2),
          },
        ],
      };
    },
  },
  {
    name: 'acuity_get_availability_times',
    description: 'Get available time slots for a specific date and appointment type',
    inputSchema: {
      type: 'object',
      properties: {
        appointmentTypeID: {
          type: 'number',
          description: 'Appointment Type ID',
        },
        date: {
          type: 'string',
          description: 'Date in YYYY-MM-DD format',
        },
        calendarID: {
          type: 'number',
          description: 'Optional calendar ID filter',
        },
        timezone: {
          type: 'string',
          description: 'Timezone (e.g., America/New_York)',
        },
      },
      required: ['appointmentTypeID', 'date'],
    },
    handler: async (args: any, client: AcuityClient) => {
      const times = await client.getAvailableTimes(args);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(times, null, 2),
          },
        ],
      };
    },
  },
];
