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

export class CreateSeatClassDto {
  @ApiProperty()
  @IsString()
  coachTypeId: string;

  @ApiProperty({ example: 'Economy Seat' })
  @IsString()
  name: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  description?: string;

  @ApiPropertyOptional({ enum: ['LOCAL', 'INTERNATIONAL'] })
  @IsOptional()
  @IsIn(['LOCAL', 'INTERNATIONAL'])
  nationalityType?: string;

  @ApiPropertyOptional({ enum: ['UPPER', 'MIDDLE', 'LOWER'] })
  @IsOptional()
  @IsString()
  bedPosition?: string;

  @ApiProperty({ example: 3000, description: 'Per-km rate in minor units (tariff decimal × 100000)' })
  @IsInt()
  @Min(0)
  basePrice: number;

  @ApiPropertyOptional({ example: 1200, description: 'Flat insurance fee in minor units' })
  @IsOptional()
  @IsInt()
  @Min(0)
  insuranceFeeMinor?: number;

  @ApiPropertyOptional({ example: true })
  @IsOptional()
  @IsBoolean()
  isActive?: boolean;
}

export class UpdateSeatClassDto extends PartialType(CreateSeatClassDto) {}
