import type {
  IncidentioIncidentRolesDeleteParams,
  IncidentioIncidentRolesDeleteResponse,
} from '@/tools/incidentio/types'
import type { ToolConfig } from '@/tools/types'

export const incidentRolesDeleteTool: ToolConfig<
  IncidentioIncidentRolesDeleteParams,
  IncidentioIncidentRolesDeleteResponse
> = {
  id: 'incidentio_incident_roles_delete',
  name: 'Delete Incident Role',
  description: 'Delete an incident role in incident.io',
  version: '1.0.0',

  params: {
    apiKey: {
      type: 'string',
      required: true,
      visibility: 'user-only',
      description: 'incident.io API Key',
    },
    id: {
      type: 'string',
      required: true,
      visibility: 'user-or-llm',
      description: 'The ID of the incident role to delete',
    },
  },

  request: {
    url: (params) => `https://api.incident.io/v2/incident_roles/${params.id}`,
    method: 'DELETE',
    headers: (params) => ({
      'Content-Type': 'application/json',
      Authorization: `Bearer ${params.apiKey}`,
    }),
  },

  transformResponse: async (response: Response) => {
    return {
      success: true,
      output: {
        message: 'Incident role deleted successfully',
      },
    }
  },

  outputs: {
    message: {
      type: 'string',
      description: 'Success message',
    },
  },
}
