import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn } from 'typeorm';

@Entity('audit_log')
export class AuditLog {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column({ nullable: true })
  usuario_id: string;

  @Column({ length: 50 })
  acao: string;

  @Column({ length: 50 })
  entidade: string;

  @Column({ nullable: true })
  entidade_id: string;

  @Column({ type: 'simple-json', nullable: true })
  dados_antes: any;

  @Column({ type: 'simple-json', nullable: true })
  dados_depois: any;

  @Column({ length: 45, nullable: true })
  ip: string;

  @Column({ type: 'text', nullable: true })
  user_agent: string;

  @CreateDateColumn()
  created_at: Date;
}
