/**
 * Intercom Teams Tools
 */

import { z } from 'zod';
import { Tool } from '@modelcontextprotocol/sdk/types.js';
import type { IntercomClient } from '../clients/intercom.js';

// Tool definitions
export function getTools(client: IntercomClient): Array<{
  definition: Tool;
  handler: (args: Record<string, unknown>) => Promise<unknown>;
}> {
  return [
    {
      definition: {
        name: 'intercom_list_teams',
        description: 'List all teams in your workspace.',
        inputSchema: {
          type: 'object',
          properties: {},
        },
      },
      handler: async () => {
        return client.listTeams();
      },
    },

    {
      definition: {
        name: 'intercom_get_team',
        description: 'Retrieve a specific team by ID, including team members and priority levels.',
        inputSchema: {
          type: 'object',
          properties: {
            id: {
              type: 'string',
              description: 'Team ID',
            },
          },
          required: ['id'],
        },
      },
      handler: async (args) => {
        const { id } = args as { id: string };
        return client.getTeam(id as any);
      },
    },
  ];
}
