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

@Entity('employees')
@Index('idx_employees_issuer', ['issuerId'])
@Index('idx_employees_store', ['storeId'])
export class Employee {
  @PrimaryGeneratedColumn('uuid') id: string;
  @Column({ name: 'issuer_id', type: 'uuid' }) issuerId: string;
  @Column({ name: 'store_id', type: 'uuid', nullable: true }) storeId: string | null;
  @Column({ type: 'varchar', length: 100 }) name: string;
  @Column({ type: 'varchar', length: 20, nullable: true }) phone: string | null;
  @Column({ type: 'varchar', length: 50, default: 'staff' }) role: string; // 'manager' | 'cashier' | 'staff'
  @Column({ type: 'varchar', length: 20, default: 'active' }) status: string;
  @CreateDateColumn({ name: 'created_at', type: 'timestamptz' }) createdAt: Date;
  @UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' }) updatedAt: Date;
}
