import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Expose } from 'class-transformer';
import {
  IsInt,
  IsOptional,
  IsString,
  IsStrongPassword,
  MaxLength,
  MinLength,
} from 'class-validator';

export class Admin {
  @Expose()
  @ApiProperty({ description: '관리자 id' })
  @IsInt()
  admId!: number;

  @Expose()
  @ApiProperty({ description: '관리자명' })
  @IsString()
  admName!: string;

  @Expose()
  @ApiProperty({ description: '관리자 로그인 아이디' })
  @IsString()
  admLoginId!: string;

  @Expose()
  @ApiProperty({ description: '관리자 평문 비밀번호' })
  @MaxLength(16)
  @MinLength(4)
  @IsString()
  @IsStrongPassword({
    minLength: 8,
    minUppercase: 0,
    minNumbers: 1,
    minSymbols: 1,
  })
  admPassword!: string;

  @Expose()
  @ApiPropertyOptional({ description: '관리자 이메일' })
  @IsOptional()
  @IsString()
  admEmail?: string;

  @Expose()
  @ApiProperty({
    description: '관리자 전화번호(숫자만)',
    example: '01012345678',
  })
  @IsString()
  admPhone!: string;

  @Expose()
  @ApiPropertyOptional({ description: '관리자 마지막 로그인 일시' })
  @IsString()
  @IsOptional()
  admLastLoginAt?: string;

  @Expose()
  @ApiPropertyOptional({ description: '관리자 수정일시' })
  @IsString()
  @IsOptional()
  admUpdatedAt?: string;

  @Expose()
  @ApiProperty({ description: '관리자 생성일시' })
  @IsString()
  admCreatedAt!: string;
}
