import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
import { Document } from 'mongoose'

export type CompanyBankDocument = CompanyBank & Document

@Schema({ timestamps: true })
export class CompanyBank {
  @Prop({ required: true })
  company: string        // 公司名称

  @Prop({ required: true })
  position: string       // 岗位

  @Prop({ type: [Object], default: [] })
  questions: Array<{
    content: string          // 问题内容
    type: string             // basic/algorithm/project/behavioral
    referenceAnswer: string  // 参考回答
    difficulty: string       // easy/medium/hard
    frequency: number        // 出现频率统计
    tags: string[]           // 标签
  }>

  @Prop({ default: 0 })
  contributionCount: number  // 用户贡献次数

  @Prop({ default: 0 })
  viewCount: number          // 查看次数
}

export const CompanyBankSchema = SchemaFactory.createForClass(CompanyBank)