import { IsString, IsEnum, IsOptional, IsArray } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export enum NotificationCategoryEnum {
  BOOKING = 'BOOKING',
  PAYMENT = 'PAYMENT',
  DISRUPTION = 'DISRUPTION',
  PROMOTION = 'PROMOTION',
  SYSTEM = 'SYSTEM',
}

export class SendNotificationDto {
  @ApiProperty() @IsString() passengerId: string;
  @ApiProperty({ example: 'Platform Change' }) @IsString() title: string;
  @ApiProperty({ example: 'Your train departs from Platform 3' }) @IsString() body: string;
  @ApiProperty({ enum: NotificationCategoryEnum }) @IsEnum(NotificationCategoryEnum) category: NotificationCategoryEnum;
  @ApiPropertyOptional({ example: 'edr://tickets/tkt_01' }) @IsOptional() @IsString() deepLink?: string;
  @ApiPropertyOptional() @IsOptional() metadata?: Record<string, any>;
}

export class TestNotificationDto {
  @ApiProperty({ example: 'booking.created' })
  @IsString()
  templateKey: string;

  @ApiProperty({ example: 'user@example.com' })
  @IsString()
  recipient: string;

  @ApiProperty({ example: { bookingRef: 'EDR123456', passengerName: 'John Doe' } })
  context: Record<string, unknown>;

  @ApiPropertyOptional({ example: ['EMAIL', 'SMS', 'IN_APP'] })
  @IsOptional()
  @IsArray()
  channels?: string[];
}
