import {
  IsString,
  IsNotEmpty,
  IsOptional,
  IsPhoneNumber,
  IsUrl,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class SendSmsDto {
  @ApiProperty({
    description: 'Phone number to send SMS to',
    example: '+33123456789',
  })
  @IsString()
  @IsNotEmpty()
  @IsPhoneNumber()
  to: string;

  @ApiProperty({
    description: 'SMS message content',
    example: 'Hello! This is a test SMS from Twilio.',
  })
  @IsString()
  @IsNotEmpty()
  message: string;

  @ApiProperty({
    description: 'Sender name (optional)',
    example: 'MyApp',
    required: false,
  })
  @IsString()
  @IsOptional()
  sender?: string;

  @ApiPropertyOptional({
    description: 'Webhook URL to call for each event triggered by the message (delivered, etc.)',
    example: 'https://your-domain.com/twilio-webhook/receive',
    required: false,
  })
  @IsUrl()
  @IsOptional()
  webUrl?: string;
}

export class SendBulkSmsDto {
  @ApiProperty({
    description: 'List of SMS to send',
    type: [SendSmsDto],
  })
  @IsNotEmpty()
  smsList: SendSmsDto[];
}
