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

export class GenerateBillsDto {
  @IsOptional()
  @IsString()
  @Matches(/^[\w-]{8,64}$/)
  operationId?: string;

  @IsString()
  @Matches(/^\d{4}-\d{2}$/)
  billingMonth: string;

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

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

export class UpdateBillStatusDto {
  @IsIn(['unpaid', 'partially_paid', 'paid'])
  status: 'unpaid' | 'partially_paid' | 'paid';
}

export class CancelBillDto {
  @IsOptional()
  @IsString()
  @Matches(/^[\w-]{8,64}$/)
  operationId?: string;

  @IsString()
  @IsNotEmpty()
  @Matches(/\S/)
  @MaxLength(300)
  reason: string;
}
