import { ArrayMaxSize, IsArray, IsEmail, IsOptional, IsString, Matches, MaxLength } from 'class-validator'

// Create a distribution list `localPart@domain` that fans mail out to recipients.
export class CreateListDto {
  @IsString()
  @MaxLength(64)
  @Matches(/^[a-zA-Z0-9._-]+$/, { message: 'list prefix may only contain letters, numbers, dots, hyphens and underscores' })
  localPart!: string

  @IsString()
  domain!: string

  @IsOptional()
  @IsString()
  @MaxLength(200)
  description?: string

  @IsOptional()
  @IsArray()
  @ArrayMaxSize(1000)
  @IsEmail({}, { each: true })
  recipients?: string[]
}
