import { BaseFilterDto } from 'src/core/modules/infrastructure/dto/base-filter.dto';
import { FilterTransactionEntity } from '../../domain/entities/filter-transaction.entity';
import { Transform } from 'class-transformer';
import { ApiProperty } from '@nestjs/swagger';

export class FilterTransactionDto
  extends BaseFilterDto
  implements FilterTransactionEntity
{
  @ApiProperty({ type: ['string'], required: false })
  @Transform((body) => {
    return Array.isArray(body.value) ? body.value : [body.value];
  })
  types?: string[];

  @ApiProperty({ type: ['string'], required: false })
  @Transform((body) => {
    return Array.isArray(body.value) ? body.value : [body.value];
  })
  customer_types?: string[];

  @ApiProperty({ type: ['string'], required: false })
  @Transform((body) => {
    return Array.isArray(body.value) ? body.value : [body.value];
  })
  customer_names?: string[];

  @ApiProperty({ type: ['string'], required: false })
  @Transform((body) => {
    return Array.isArray(body.value) ? body.value : [body.value];
  })
  payment_types?: string[];

  @ApiProperty({ type: ['string'], required: false })
  @Transform((body) => {
    return Array.isArray(body.value) ? body.value : [body.value];
  })
  payment_banks?: string[];

  @ApiProperty({ type: ['string'], required: false })
  @Transform((body) => {
    return Array.isArray(body.value) ? body.value : [body.value];
  })
  invoice_codes?: string[];

  @ApiProperty({ type: ['string'], required: false })
  @Transform((body) => {
    return Array.isArray(body.value) ? body.value : [body.value];
  })
  refund_codes?: string[];

  @ApiProperty({ type: ['string'], required: false })
  @Transform((body) => {
    return Array.isArray(body.value) ? body.value : [body.value];
  })
  creator_names?: string[];

  @ApiProperty({ type: Date, required: false })
  booking_date_from?: Date;

  @ApiProperty({ type: Date, required: false })
  booking_date_to?: Date;

  @ApiProperty({ type: Date, required: false })
  invoice_date_from?: Date;

  @ApiProperty({ type: Date, required: false })
  invoice_date_to?: Date;

  @ApiProperty({ type: Date, required: false })
  settlement_date_from?: Date;

  @ApiProperty({ type: Date, required: false })
  settlement_date_to?: Date;
}
