import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { VM } from "../../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel";
import { TableCheckpointLevel } from "../../common/table/TableCheckpointLevel";
import { VehicleType } from "../../vehicle/model/VehicleEnum";




@ecs.register('CheckpointModelLevel')
export class CheckpointModelLevelComp extends ecs.Comp {
    /** 下个关卡配置 */
    rtluNext: TableCheckpointLevel = new TableCheckpointLevel();
    /** 当前关卡配置 */
    rtluCurrent: TableCheckpointLevel = new TableCheckpointLevel();

    /** 提供 VM 组件使用的数据 */
    vm: CheckpointLevelVM = new CheckpointLevelVM();

    vmAdd() {
        VM.add(this.vm, "CheckpointLevel");
    }

    vmRemove() {
        this.vm.reset();
        VM.remove("CheckpointLevel");
    }

    reset() {
        this.vmRemove();
    }
}

class CheckpointLevelVM {
    /** 当前等级 */
    lv: number = 0;
    /** 站台数 */
    stationCount: number = 0;
    /** 格子数 */
    gridRowCount: number = 0;
    gridColCount: number = 0;
    /** 人数 */
    peopleCount: number = 0;
    /** 下一个关卡载具类型 */
    vehicleType: VehicleType = null
    reset() {
        this.lv = 0;
        this.stationCount = 0;
        this.gridColCount = 0;
        this.gridRowCount = 0;
        this.peopleCount = 0;
        this.vehicleType = null
    }
}