import { Entity, Column } from 'typeorm';
import { BaseEntity } from '@genex/common';

@Entity('audit_logs')
export class AuditLog extends BaseEntity {
  @Column({ name: 'admin_id', type: 'uuid' })
  adminId: string;

  @Column({ name: 'admin_name' })
  adminName: string;

  @Column()
  action: string;

  @Column()
  resource: string;

  @Column({ name: 'resource_id', nullable: true })
  resourceId: string;

  @Column({ name: 'ip_address', length: 45, nullable: true })
  ipAddress: string;

  @Column({ type: 'varchar', length: 20, default: 'success' })
  result: string;

  @Column({ type: 'jsonb', nullable: true })
  details: any;
}
