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

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

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

  @Column({ type: 'varchar', length: 255 })
  host!: string;

  @Column({ type: 'int', default: 22 })
  sshPort!: number;

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

  @Column({ type: 'text', name: 'ssh_key_encrypted' })
  sshKeyEncrypted!: string;

  @Column({ type: 'text', name: 'ssh_key_iv' })
  sshKeyIv!: string;

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

  @Column({ type: 'int', default: 0, name: 'current_instances' })
  currentInstances!: number;

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

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

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

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

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