import { IsNotEmpty, IsNumber, IsOptional, IsEnum, IsDateString, Min } from 'class-validator';

export class QueryCalendarDto {
  @IsNotEmpty({ message: '开始日期不能为空' })
  @IsDateString()
  startDate: string;

  @IsNotEmpty({ message: '结束日期不能为空' })
  @IsDateString()
  endDate: string;
}

export class BatchUpdateCalendarDto {
  @IsNotEmpty({ message: '房源ID不能为空' })
  @IsNumber()
  roomId: number;

  @IsNotEmpty({ message: '开始日期不能为空' })
  @IsDateString()
  startDate: string;

  @IsNotEmpty({ message: '结束日期不能为空' })
  @IsDateString()
  endDate: string;

  @IsOptional()
  @IsNumber()
  @Min(0)
  price?: number;

  @IsOptional()
  @IsNumber()
  @Min(0)
  stock?: number;

  @IsOptional()
  @IsEnum(['available', 'unavailable'])
  status?: 'available' | 'unavailable';
}

export class SingleDayUpdateDto {
  @IsNotEmpty({ message: '房源ID不能为空' })
  @IsNumber()
  roomId: number;

  @IsNotEmpty({ message: '日期不能为空' })
  @IsDateString()
  date: string;

  @IsOptional()
  @IsNumber()
  @Min(0)
  price?: number;

  @IsOptional()
  @IsNumber()
  @Min(0)
  stock?: number;

  @IsOptional()
  @IsEnum(['available', 'unavailable'])
  status?: 'available' | 'unavailable';
}
