// GVGTeam 数据库表，存储 GVG 队伍信息
import BaseModel from "./BaseModel";
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';

@index({ roleId: 1, teamId: 1 })
@index({ teamCode: 1 })
export default class GVGTeam extends BaseModel {
    @prop({ required: true })
    roleId: string;     // 玩家id

    @prop({ required: true })
    teamCode: string;     // 玩家队伍id，3个队伍

    @prop({ required: true })
    leagueCode: string; // 联军

    @prop({ required: false })
    areaId: number;

    @prop({ required: false })
    cityId: number;

    @prop({ required: false })
    pointId: number;

    @prop({ required: true })
    head: number;       // 头像

    @prop({ required: true })
    spine: number;      // 形象

    @prop({ required: true })
    frame: number;      // 相框

    @prop({ required: true, default: 0 })
    durability: number; // 耐久

    @prop({ required: true, default: 0 })
    restartTime: number; // 修整期倒计时

    @prop({ required: true, default: 0 })
    attackTime: number;  // 进攻冷却时间

    @prop({ required: true, default: 0 })
    moveTime: number;    // 移动冷却时间

    @prop({ required: true, default: 0 })
    defenseTime: number; // 防守保护时间

    @prop({ required: true })
    lineup: [{
        actorId: number;  // 武将id
        dataId: number;   // 位置
        order: number;    // 进攻顺序
    }]
}

export const GVGTeamModel = getModelForClass(GVGTeam);

export interface GVGTeamType extends Pick<DocumentType<GVGTeam>, keyof GVGTeam> {
    id: number;
};
