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

@Entity('system_experiences')
export class SystemExperienceORM {
  @PrimaryColumn('uuid')
  id: string;

  @Column({ name: 'experience_type', length: 30 })
  experienceType: string;

  @Column('text')
  content: string;

  @Column({ default: 50 })
  confidence: number;

  @Column('text')
  scenario: string;

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

  @Column('uuid', { name: 'source_conversation_ids', array: true, default: '{}' })
  sourceConversationIds: string[];

  @Column({ name: 'verification_status', length: 20, default: 'PENDING' })
  verificationStatus: string;

  @Column({ name: 'verified_by', nullable: true })
  verifiedBy: string;

  @Column({ name: 'verified_at', nullable: true })
  verifiedAt: Date;

  @Column({ name: 'usage_count', default: 0 })
  usageCount: number;

  @Column({ name: 'positive_count', default: 0 })
  positiveCount: number;

  @Column({ name: 'negative_count', default: 0 })
  negativeCount: number;

  // pgvector VECTOR(1536) - exclude from default selects to avoid type conflicts
  @Column({ type: 'text', name: 'embedding', nullable: true, select: false })
  embedding: string;

  @Column({ name: 'is_active', default: false })
  isActive: boolean;

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

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