package cc.smtweb.biz.mztb.web.base.partyDataFill;

import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.web.engine.model.listcard.lcms.LCMsService;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;

/**
 * Created by 1 at 2023-12-19 11:06:53
 * 页面【[机构数据填报编辑]的服务类
 */
@SwService
public class PartyDataFillService extends LCMsService {
    public final static String TYPE_CUSTOM = "custom";

    @Override
    public AbstractHandler createHandler(String type) {
        switch (type) {
            case TYPE_MODEL_SAVE:
                return new PartyDataFillHandler.PartyDataFillModelSaveHandler();
            case TYPE_MODEL_LOAD:
                return new PartyDataFillHandler.PartyDataFillModelLoadHandler();
            case TYPE_MODEL_LIST:
                return new PartyDataFillHandler.PartyDataFillModelListHandler();
            case TYPE_CUSTOM:
                return new PartyDataCustomHandler();
        }
        return super.createHandler(type);
    }

    /* demo
        //自定义
        public R demo(@SwBody SwMap params, UserSession us) {
            return pageHandler(params, us, TYPE_DEMO, handler -> ((DemoHandler)handler).demo());
        }
    */
    public R logicDel(@SwBody SwMap params, UserSession us) {
        return pageHandler(params, us, TYPE_CUSTOM, handler -> ((PartyDataCustomHandler) handler).logicDel(params, us));
    }

    public R affirm(@SwBody SwMap params, UserSession us) {
        return pageHandler(params, us, TYPE_CUSTOM, handler -> ((PartyDataCustomHandler) handler).affirm(params, us));
    }

    public R cancelAffirm(@SwBody SwMap params, UserSession us) {
        return pageHandler(params, us, TYPE_CUSTOM, handler -> ((PartyDataCustomHandler) handler).cancelAffirm(params, us));
    }

    public R pushData(@SwBody SwMap params, UserSession us) {
        return pageHandler(params, us, TYPE_CUSTOM, handler -> ((PartyDataCustomHandler) handler).pushData(params, us));
    }
    // 检查当前机构是否有重复任务
    public R checkRepetition(@SwBody SwMap params, UserSession us) {
        return pageHandler(params, us, TYPE_CUSTOM, handler -> ((PartyDataCustomHandler) handler).checkRepetition(params, us));
    }

}
