import { BaseEntity } from '@cool-midway/core';
import { Column, Entity, Index } from 'typeorm';

/**
 * 知识信息
 */
@Entity('know_data_info')
export class KnowDataInfoEntity extends BaseEntity {
  @Index()
  @Column({ comment: '类型ID' })
  typeId: number;

  @Column({ comment: '标题', nullable: true })
  title: string;

  // 为了兼容postgre
  @Column({ comment: '内容', type: 'json' })
  content: {
    data: string;
  };

  @Column({ comment: '来源 0-自定义 1-文件 2-链接', default: 0 })
  from: number;

  @Column({ comment: '元数据', type: 'json', nullable: true })
  metadata: {
    [key: string]: any;
  };

  @Column({ comment: '状态 0-准备中 1-已就绪', default: 0 })
  status: number;

  @Column({ comment: '启用 0-禁用 1-启用', default: 1 })
  enable: number;
}
