import { IsOptional, IsString, IsInt, Min, Max } from 'class-validator';
import { Type } from 'class-transformer';

/**
 * Query DTO for GET /previous-nc/paged
 * Mirrors the filter options visible in the Laravel NC list page.
 */
export class ListPreviousNcsDto {
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  page?: number = 1;

  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  @Max(200)
  limit?: number = 25;

  @IsOptional()
  @IsString()
  user_name?: string;
  /** 'All' | 'QRS' | 'TQS' */
  @IsOptional()
  @IsString()
  source?: string = 'All';

  /** 'All' | 'open' | 'closed' */
  @IsOptional()
  @IsString()
  status?: string = 'All';

  /** 'All' | 'Major' | 'Minor' | 'Observation' */
  @IsOptional()
  @IsString()
  nc_type?: string = 'All';

  /** 'All' | 'initial audit' | 'surveillance(No. 01)' | 'Re-Assessment' | 'Other' */
  @IsOptional()
  @IsString()
  audit_type?: string = 'All';

  /** Free text search on company name */
  @IsOptional()
  @IsString()
  search?: string = '';

  /** Optional date range filter on created_at */
  @IsOptional()
  @IsString()
  date_from?: string;

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