package com.xisc.pm.app.service.autoboard.core;

import java.util.Queue;

import com.xisc.pm.app.service.autoboard.dto.PmAutoBoardExecParam;
import com.xisc.pm.app.service.autoboard.dto.PmAutoBoardExecResult;
import com.xisc.pm.app.service.autoboard.dto.PmAutoBoardPolicyGroupDTO;
import com.xisc.pm.app.service.autoboard.dto.PmContBoardParam;
import com.xisc.pm.infra.enums.FormPlateMode;

/**
 * 
 * @author jun.zeng
 *
 */
public class PmPdProgramFactory {
    
    public static DefaultPmPdProgram build(Queue<PmContBoardParam> priorityQueue, PmAutoBoardExecResult execResult, PmAutoBoardExecParam current,
            PmAutoBoardPolicyGroupDTO policyGroup , String formModeCode){
        FormPlateMode formPlateMode = FormPlateMode.getByCode(formModeCode);
        if(FormPlateMode.A1.getType().equals(formPlateMode.getType())) {
            return new PmPdProgramA(priorityQueue, execResult, current, policyGroup , formPlateMode);
        } else if(FormPlateMode.S.getType().equals(formPlateMode.getType())){
            if(current.isSPlusEnable()) {
                return new PmPdProgramSPlus(priorityQueue, execResult, current, policyGroup , formPlateMode);
            } else {
                return new PmPdProgramS(priorityQueue, execResult, current, policyGroup , formPlateMode);
            }
        }
        return null;
    }
    
}

