package nckd.jxccl.hrmp.hbpm.plugin.operate.hr;

import kd.bos.dataentity.OperateOption;
import kd.bos.entity.operate.OperateOptionConst;
import kd.bos.entity.plugin.AddValidatorsEventArgs;
import nckd.jxccl.hrmp.hbpm.common.hr.PositionBillConstant;
import nckd.jxccl.hrmp.hbpm.plugin.operate.hr.validator.PositionAddSaveValidator;

/**
 * 岗位申请-岗位新设保存操作插件
 * @entity: nckd_posbillentryadd
 * @from: kd.hr.homs.opplugin.web.orgbatch.AdminOrgBatchDetailAddSaveOp
 * @author: jtd
 * @date: 2025/12/18 09:57
 */
public class PosBillEntryAddSaveOpPlugin extends PositionBillEntrySaveOpPlugin {

    @Override
    public void onAddValidators(AddValidatorsEventArgs e) {
        super.onAddValidators(e);

        OperateOption option = getOption();
        String onlyValidate = option.getVariableValue(OperateOptionConst.ONLY_VALIDATE, Boolean.FALSE.toString());
        if (Boolean.TRUE.toString().equals(onlyValidate)) {
            e.addValidator(new PositionAddSaveValidator());
        }
    }

    @Override
    protected String getOperationKey() {
        return PositionBillConstant.SAVE_OP;
    }
}
