import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsEnum, IsOptional, IsString, Length } from 'class-validator';
import {
  SUPPORT_TICKET_CATEGORIES,
  SUPPORT_TICKET_PRIORITIES,
  SupportTicketCategory,
  SupportTicketPriority,
} from '../schemas/support-ticket.schema';

export class CreateSupportTicketDto {
  @ApiProperty({ maxLength: 150 })
  @IsString()
  @Length(1, 150)
  subject!: string;

  @ApiProperty({ maxLength: 5000 })
  @IsString()
  @Length(1, 5000)
  message!: string;

  @ApiPropertyOptional({ enum: SUPPORT_TICKET_CATEGORIES, default: 'technical' })
  @IsOptional()
  @IsEnum(SUPPORT_TICKET_CATEGORIES)
  category?: SupportTicketCategory = 'technical';

  @ApiPropertyOptional({ enum: SUPPORT_TICKET_PRIORITIES, default: 'normal' })
  @IsOptional()
  @IsEnum(SUPPORT_TICKET_PRIORITIES)
  priority?: SupportTicketPriority = 'normal';
}
