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

export class SponsorshipDTO {
  @ApiProperty()
  @IsString()
  id: string = '';

  @ApiProperty({ enum: ['leagues', 'teams', 'drivers', 'races', 'platform'] })
  @IsEnum(['leagues', 'teams', 'drivers', 'races', 'platform'])
  type: 'leagues' | 'teams' | 'drivers' | 'races' | 'platform' = 'leagues';

  @ApiProperty()
  @IsString()
  entityId: string = '';

  @ApiProperty()
  @IsString()
  entityName: string = '';

  @ApiProperty({ enum: ['main', 'secondary'], required: false })
  @IsOptional()
  @IsEnum(['main', 'secondary'])
  tier?: 'main' | 'secondary';

  @ApiProperty({ enum: ['active', 'pending_approval', 'approved', 'rejected', 'expired'] })
  @IsEnum(['active', 'pending_approval', 'approved', 'rejected', 'expired'])
  status: 'active' | 'pending_approval' | 'approved' | 'rejected' | 'expired' = 'pending_approval';

  @ApiProperty({ required: false })
  @IsOptional()
  @IsDateString()
  applicationDate?: string;

  @ApiProperty({ required: false })
  @IsOptional()
  @IsDateString()
  approvalDate?: string;

  @ApiProperty({ required: false })
  @IsOptional()
  @IsString()
  rejectionReason?: string;

  @ApiProperty()
  @IsDateString()
  startDate: string = '';

  @ApiProperty()
  @IsDateString()
  endDate: string = '';

  @ApiProperty()
  @IsNumber()
  price: number = 0;

  @ApiProperty()
  @IsNumber()
  impressions: number = 0;

  @ApiProperty({ required: false })
  @IsOptional()
  @IsNumber()
  impressionsChange?: number;

  @ApiProperty({ required: false })
  @IsOptional()
  @IsNumber()
  engagement?: number;

  @ApiProperty({ required: false })
  @IsOptional()
  @IsString()
  details?: string;

  @ApiProperty({ required: false })
  @IsOptional()
  @IsString()
  entityOwner?: string;

  @ApiProperty({ required: false })
  @IsOptional()
  @IsString()
  applicationMessage?: string;
}