import { Column, CreateDateColumn, DeleteDateColumn, UpdateDateColumn } from 'typeorm';

/**
 * TypeORM Entity
 *
 * @export
 * @abstract
 * @class BaseModel
 * @typedef {BaseModel}
 */
export abstract class BaseModel {
	/**
	 * 모든 테이블의 기본 키 (Primary Key)
	 */
	// @PrimaryGeneratedColumn()
	// no: number;

	/**
	 * 데이터가 처음 생성된 시간
	 */
	@CreateDateColumn({
		name: 'reg_dt',
		type: 'timestamp',
		nullable: false,
		default: () => 'NOW()',
		comment: '등록일시',
	})
	regDt: Date;

	/**
	 *데이터가 마지막으로 업데이트된 시간
	 */
	@UpdateDateColumn({
		name: 'updt_dt',
		type: 'timestamp',
		nullable: true,
		comment: '수정일시',
	})
	updtDt: Date;

	/**
	 * Soft Delete 삭제일시 (NULL이면 활성 데이터)
	 */
	@DeleteDateColumn({
		name: 'del_dt',
		type: 'timestamp',
		nullable: true,
		comment: '삭제일시 (Soft Delete, NULL=활성)',
	})
	delDt: Date;

	@Column({
		name: 'reg_ip',
		type: 'varchar',
		length: 50,
		nullable: true,
		comment: '등록 IP',
	})
	regIp: string;

	@Column({
		name: 'reg_user_id',
		type: 'varchar',
		length: 100,
		nullable: true,
		comment: '등록자 ID',
	})
	regUserId: string;

	@Column({
		name: 'updt_ip',
		type: 'varchar',
		length: 50,
		nullable: true,
		comment: '수정 IP',
	})
	updtIp: string;

	@Column({
		name: 'updt_user_id',
		type: 'varchar',
		length: 100,
		nullable: true,
		comment: '수정자 ID',
	})
	updtUserId: string;
}
