import {
  IsString,
  IsNotEmpty,
  IsUUID,
  IsEnum,
  IsObject,
  IsOptional,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { NotificationType } from '@prisma/client';

export class SendNotificationDto {
  @ApiProperty({
    description: 'Target user UUID',
    example: '550e8400-e29b-41d4-a716-446655440000',
  })
  @IsUUID()
  @IsNotEmpty()
  userId: string;

  @ApiProperty({
    description: 'Notification type',
    enum: NotificationType,
    example: NotificationType.CLIENT_ASSIGNED,
  })
  @IsEnum(NotificationType)
  type: NotificationType;

  @ApiProperty({
    description: 'Notification title',
    example: 'Новый клиент',
  })
  @IsString()
  @IsNotEmpty()
  title: string;

  @ApiProperty({
    description: 'Notification body text',
    example: 'Вам назначен новый клиент: Иван Петров',
  })
  @IsString()
  @IsNotEmpty()
  body: string;

  @ApiPropertyOptional({
    description: 'Additional JSON data for deep linking',
    example: { screen: 'client', clientId: '550e8400-e29b-41d4-a716-446655440000' },
  })
  @IsObject()
  @IsOptional()
  data?: Record<string, any>;
}
