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

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

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

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