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

export type HotPositionDocument = HotPosition & Document

export type PositionCategory = "ai" | "traditional"

@Schema({ timestamps: true })
export class HotPosition {
  @Prop({ required: true })
  name: string

  @Prop({ default: "" })
  salary?: string

  @Prop({ default: "" })
  company?: string

  @Prop({ default: "" })
  icon?: string

  @Prop({ default: 0 })
  sort: number

  @Prop({ default: true })
  active: boolean

  @Prop({ type: String, enum: ["ai", "traditional"], default: "traditional" })
  category: PositionCategory
}

export const HotPositionSchema = SchemaFactory.createForClass(HotPosition)
HotPositionSchema.index({ sort: 1 })
HotPositionSchema.index({ category: 1, active: 1 })
