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

@Entity('organizations')
export class Organization {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ name: 'public_id', type: 'varchar', length: 36, unique: true })
  publicId: string;

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

  @Column({ length: 100 })
  name: string;

  @Column({ name: 'is_host', default: false })
  isHost: boolean;

  @Column({ name: 'contact_name', length: 50, nullable: true })
  contactName: string;

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

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

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

  @Column({ type: 'varchar', length: 20, default: 'active' })
  status: 'active' | 'archived';

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

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