import BaseModel from "./BaseModel";
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';

@index({ configId: 1, cityId: 1 })
// GVGCity 类，继承自 BaseModel
export default class GVGCity extends BaseModel {
    @prop({ required: true, default: 1 })
    configId: number;       // config唯一id 

    @prop({ required: true })
    cityId: number;         // 城池id

    @prop({ required: true })
    leagueCodes: string[];  // 联军

    @prop({ required: false })
    guardLeague: string;    // 占领的联军

    @prop({ required: false })
    guardLeagueName: string;    // 占领的联军

    @prop({ required: true, default: 0 })
    userCnt: number;        // 城池人数

    @prop({ required: true, default: 0 })
    teamCnt: number;        // 城池队伍数
}


export const GVGCityModel = getModelForClass(GVGCity);

export interface GVGCityType extends Pick<DocumentType<GVGCity>, keyof GVGCity> {
    id: number;
};