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

@Entity({ name: 'users' })
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ unique: true, length: 50 })
  username: string;

  @Column({ unique: true, length: 100 })
  email: string;

  @Column({ length: 255 })
  password: string;

  @Column({
    type: 'enum',
    enum: ['seeker', 'recruiter', 'admin', 'franchise', 'associate'],
    default: 'seeker',
  })
  role: 'seeker' | 'recruiter' | 'admin' | 'franchise' | 'associate';

  @Column({ name: 'full_name', length: 150 })
  fullName: string;

  @Column({ length: 20, nullable: true })
  phone: string;

  @Column({ name: 'profile_picture', length: 255, nullable: true })
  profilePicture: string;

  @Column({
    name: 'seeker_type',
    type: 'enum',
    enum: ['entry_level', 'mid_level', 'professional'],
    nullable: true,
  })
  seekerType: 'entry_level' | 'mid_level' | 'professional';

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

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

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