import { ArrayNotEmpty, IsArray, IsDateString, IsIn, IsInt, IsNumber, IsString, IsOptional, Min } from 'class-validator';

export class CreateDepositDto {
  @IsInt()
  studentId: number;

  @IsNumber({ maxDecimalPlaces: 2 })
  @Min(0.01)
  amount: number;

  @IsDateString()
  paidDate: string;

  @IsOptional()
  @IsString()
  notes?: string;
}

export class BatchCreateDepositDto {
  @IsArray()
  @ArrayNotEmpty()
  @IsInt({ each: true })
  studentIds: number[];

  @IsNumber({ maxDecimalPlaces: 2 })
  @Min(0.01)
  amount: number;

  @IsDateString()
  paidDate: string;

  @IsOptional()
  @IsString()
  notes?: string;

  @IsOptional()
  @IsString()
  roomType?: string;
}

export class RefundDepositDto {
  @IsDateString()
  refundDate: string;

  @IsOptional()
  @IsString()
  notes?: string;
}

export class CreateDepositInstallmentDto {
  @IsNumber({ maxDecimalPlaces: 2 })
  @Min(0.01)
  amount: number;

  @IsDateString()
  dueDate: string;
}

export class UpdateDepositInstallmentDto {
  @IsOptional()
  @IsDateString()
  paidDate?: string;

  @IsOptional()
  @IsIn(['pending', 'paid', 'overdue'])
  status?: string;
}
