import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
import { UserEntity } from '../../../../user-related/user/domain/entities/user.entity';
import { Column, Entity } from 'typeorm';
import { BaseCoreModel } from 'src/core/modules/data/model/base-core.model';
import { LogUserLoginEntity } from '../../domain/entities/log-user-login.entity';
import { UserRole } from '../../../../user-related/user/constants';
import { AppSource, LogUserType } from 'src/core/helpers/constant';

@Entity(TABLE_NAME.LOG_USER_LOGIN)
export class LogUserLoginModel
  extends BaseCoreModel<UserEntity>
  implements LogUserLoginEntity
{
  @Column({ type: 'enum', enum: LogUserType, nullable: true })
  type: LogUserType;

  @Column({ type: 'enum', enum: UserRole, nullable: true })
  role: UserRole;

  @Column({ type: 'uuid', nullable: true })
  user_id: string;

  @Column({ type: 'uuid', nullable: true })
  item_id: string;

  @Column({ type: 'varchar', nullable: true })
  item_name: string;

  @Column({ type: 'varchar', nullable: true })
  username: string;

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

  @Column({ type: 'enum', enum: AppSource, nullable: true })
  source: AppSource;
}
