import { typeParser } from '@lib/utils/type-parser';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Expose, Transform } from 'class-transformer';
import { IsInt, IsOptional, IsString } from 'class-validator';

export class Authority {
  @Expose()
  @ApiProperty({ description: '권한 id' })
  @Transform(({ value }) => typeParser.int(value))
  @IsInt()
  athId!: number;

  @Expose()
  @ApiProperty({ description: '권한명' })
  @IsString()
  athName!: string;

  @Expose()
  @ApiPropertyOptional({ description: 'IP수정일시' })
  @IsString()
  @IsOptional()
  athUpdatedAt?: string;

  @Expose()
  @ApiProperty({ description: 'IP생성일시' })
  @IsString()
  athCreatedAt!: string;
}
