import { BaseCoreModel } from 'src/core/modules/data/model/base-core.model';
import { LogEntity } from '../../domain/entities/log.entity';
import { Column, Entity } from 'typeorm';
import { OPERATION } from 'src/core/strings/constants/base.constants';
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';

@Entity(TABLE_NAME.LOG)
export class LogModel extends BaseCoreModel<LogEntity> implements LogEntity {
  @Column('varchar', { name: 'data_id', nullable: true })
  data_id: string;

  @Column('varchar', { name: 'module', nullable: true })
  module: string;

  @Column('varchar', { name: 'sub_module', nullable: true })
  sub_module: string;

  @Column('text', { name: 'description', nullable: true })
  description: string;

  @Column('varchar', { name: 'process', default: OPERATION.CREATE })
  process: OPERATION;

  @Column('json', { name: 'data', nullable: true })
  data: any;

  @Column('json', { name: 'old_data', nullable: true })
  old_data: any;

  @Column('bigint', { name: 'created_at', nullable: true })
  created_at: number;

  @Column('varchar', { name: 'creator_name', nullable: true })
  creator_name: string;

  @Column('varchar', { name: 'creator_id', nullable: true })
  creator_id: string;
}
