import {
  IsString,
  IsOptional,
  IsBoolean,
  IsInt,
  IsDateString,
  IsUrl,
  MaxLength,
  Min,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class CreateTradeEventDto {
  @ApiProperty({ maxLength: 200, description: 'Name der Messe / Veranstaltung' })
  @IsString()
  @MaxLength(200)
  name!: string;

  @ApiPropertyOptional({ description: 'Beschreibung' })
  @IsOptional()
  @IsString()
  @MaxLength(2000)
  description?: string;

  @ApiProperty({ description: 'Startdatum (ISO 8601)' })
  @IsDateString()
  startDate!: string;

  @ApiProperty({ description: 'Enddatum (ISO 8601)' })
  @IsDateString()
  endDate!: string;

  @ApiPropertyOptional({ maxLength: 300, description: 'Standort / Stadt' })
  @IsOptional()
  @IsString()
  @MaxLength(300)
  location?: string;

  @ApiPropertyOptional({
    maxLength: 200,
    description: 'Halle / Stand-Informationen',
  })
  @IsOptional()
  @IsString()
  @MaxLength(200)
  boothInfo?: string;

  @ApiPropertyOptional({ maxLength: 500, description: 'Website-URL' })
  @IsOptional()
  @IsUrl({}, { message: 'websiteUrl muss eine gueltige URL sein' })
  @MaxLength(500)
  websiteUrl?: string;

  @ApiPropertyOptional({ default: true, description: 'Auf Dashboard anzeigen' })
  @IsOptional()
  @IsBoolean()
  isActive?: boolean;

  @ApiPropertyOptional({ default: 0, description: 'Sortierreihenfolge' })
  @IsOptional()
  @IsInt()
  @Min(0)
  sortOrder?: number;
}
