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

@Entity({ name: 'tenants', schema: 'public' })
export class Tenant {
  @PrimaryGeneratedColumn('uuid')
  id!: string;

  @Column({ type: 'varchar', length: 100 })
  name!: string;

  @Column({ type: 'varchar', length: 50, unique: true })
  slug!: string;

  @Column({ type: 'varchar', length: 20, default: 'free' })
  plan!: 'free' | 'pro' | 'enterprise';

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

  @Column({ type: 'varchar', length: 255, nullable: true })
  adminEmail?: string;

  @Column({ type: 'int', default: 10 })
  maxServers!: number;

  @Column({ type: 'int', default: 5 })
  maxUsers!: number;

  @Column({ type: 'int', default: 20 })
  maxStandingOrders!: number;

  @Column({ type: 'int', default: 100000 })
  maxAgentTokensPerMonth!: number;

  @CreateDateColumn({ type: 'timestamptz' })
  createdAt!: Date;

  @UpdateDateColumn({ type: 'timestamptz' })
  updatedAt!: Date;
}
