import {
  IsOptional,
  IsUrl,
  IsArray,
  IsEnum,
  IsBoolean,
  ArrayMinSize,
} from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { WebhookEvent } from './create-webhook.dto';

export class UpdateWebhookDto {
  @ApiPropertyOptional({ description: 'Webhook delivery URL' })
  @IsUrl()
  @IsOptional()
  url?: string;

  @ApiPropertyOptional({
    description: 'Events to subscribe to',
    enum: WebhookEvent,
    isArray: true,
  })
  @IsArray()
  @ArrayMinSize(1)
  @IsEnum(WebhookEvent, { each: true })
  @IsOptional()
  events?: WebhookEvent[];

  @ApiPropertyOptional({ description: 'Whether webhook is active' })
  @IsBoolean()
  @IsOptional()
  isActive?: boolean;
}
