import { IsNotEmpty, IsOptional, IsString, IsUUID, MaxLength, Matches } from 'class-validator';

/**
 * One slot row sent inside CreateActivityTicketDto.slots.
 *
 * Either or both of `start_time` / `end_time` may be set. The FE
 * derives `label` from the time pair when set ("10:00 - 16:00") or
 * keeps a typed override (for prose-style slots like "After sunset").
 */
export class CreateActivityTicketSlotDto {
  @IsUUID()
  @IsOptional()
  id?: string;

  @IsString()
  @IsNotEmpty()
  @MaxLength(100)
  label: string;

  @IsString()
  @IsOptional()
  @Matches(/^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/, { message: 'start_time must be HH:MM or HH:MM:SS' })
  start_time?: string | null;

  @IsString()
  @IsOptional()
  @Matches(/^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/, { message: 'end_time must be HH:MM or HH:MM:SS' })
  end_time?: string | null;
}
