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

@Entity('role_access') // table name is 'role_access'
export class RoleAccessEntity {
  @PrimaryGeneratedColumn({ type: 'int', name: 'id' })
  id: number;

  @Column('int', { name: 'user_id', nullable: false })
  userId: number;

  @Column('varchar', { length: 100, nullable: false })
  role: string; // Example: "Admin", "RecruiterManager"

  @Column('int', { name: 'module_id', nullable: false })
  moduleId: number;

  @Column('enum', {
    enum: ['active', 'inactive'],
    default: 'active',
    nullable: false,
  })
  status: 'active' | 'inactive';

  @CreateDateColumn({ name: 'created_at', type: 'timestamp' })
  createdAt: Date;

  @UpdateDateColumn({ name: 'updated_at', type: 'timestamp' })
  updatedAt: Date;
}
