/**
 * Per-tenant agent configuration entity.
 *
 * Stores the global agent settings for a tenant:
 * - engine: which Claude engine to use (claude-cli or claude-api)
 * - systemPrompt: base system prompt prepended to every agent interaction
 * - maxTurns: maximum agentic turns per task
 * - maxBudget: maximum USD spend per task
 * - allowedTools: which SDK tools the agent may invoke
 */
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';

@Entity('agent_configs')
export class AgentConfig {
  @PrimaryGeneratedColumn('uuid')
  id!: string;

  @Column({ type: 'varchar', length: 20 })
  tenantId!: string;

  @Column({ type: 'varchar', length: 30, default: 'claude-cli' })
  engine!: string;

  @Column({ type: 'text', default: '' })
  systemPrompt!: string;

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

  @Column({ type: 'float', default: 5.0 })
  maxBudget!: number;

  @Column({ type: 'varchar', array: true, default: "'{Bash,Read,Write,Glob,Grep}'" })
  allowedTools!: string[];

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

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