import { IsString, IsUrl, IsArray, IsEnum, IsOptional, IsBoolean } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { WebhookEventType } from '../enums/webhook-event-type.enum';

export class UpdateWebhookDto {
  @ApiProperty({
    description: 'Webhook URL to send events to',
    example: 'https://example.com/webhooks/events',
    required: false,
  })
  @IsOptional()
  @IsUrl()
  url?: string;

  @ApiProperty({
    description: 'Array of event types to subscribe to',
    enum: WebhookEventType,
    isArray: true,
    required: false,
  })
  @IsOptional()
  @IsArray()
  @IsEnum(WebhookEventType, { each: true })
  events?: WebhookEventType[];

  @ApiProperty({
    description: 'Enable or disable the webhook',
    example: true,
    required: false,
  })
  @IsOptional()
  @IsBoolean()
  isActive?: boolean;

  @ApiProperty({
    description: 'Optional description for the webhook',
    required: false,
  })
  @IsOptional()
  @IsString()
  description?: string;
}
