import { User } from '../../../repositories/users/entity/user.entity';
import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  CreateDateColumn,
  UpdateDateColumn,
  OneToMany,
} from 'typeorm';

@Entity({ name: 'accounts' })
export class Account {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ nullable: true })
  parent_account_id?: number;

  @Column()
  tier: number;

  @Column()
  country: string;

  @Column()
  delegation_permission: boolean;

  @Column()
  locked: boolean;

  @Column()
  company_name: string;

  @Column()
  verified: boolean;

  @Column({ nullable: true })
  primary_admin_user_id?: number;

  @Column({ nullable: true })
  secondary_admin_user_id?: number;

  @Column({ nullable: true })
  deleted_at?: Date;

  @Column()
  created_by: string;

  @CreateDateColumn()
  created_at: Date;

  @Column()
  updated_by: string;

  @UpdateDateColumn()
  updated_at: Date;

  @OneToMany(() => User, (user) => user.id)
  user?: User[];
}
