package com.brilliance.isc.swift.objmtconvert.manager;

import com.brilliance.isc.swift.objmtconvert.model.AbsCreator;
import com.brilliance.isc.swift.objmtconvert.model.AbsMTCreator;
import com.brilliance.isc.swift.objmtconvert.model.AbsMXCreator;
import com.brilliance.isc.swift.objmtconvert.result.Result;
import com.brilliance.isc.swift.objmtconvert.util.MTUtil;

/**
 * @Description
 * @Author s_guodong
 * @Date 2023/4/19
 */
public class CreatorManager {

    public static Result pack(String json) {
        Result result = null;
        String type = MTUtil.getType(json);
        if (AbsMXCreator.TYPE.equalsIgnoreCase(type)) {
            result = MxCreatorManager.pack(json);
        } else {
            result = MtCreatorManager.packMt(json);
        }
        return result;
    }

    public static Result pack(AbsCreator absCreator) {
        Result result = null;
        String type = absCreator.getType();
        if (AbsMXCreator.TYPE.equalsIgnoreCase(type)) {
            result = MxCreatorManager.pack((AbsMXCreator) absCreator);
        } else {
            result = MtCreatorManager.packMT((AbsMTCreator) absCreator);
        }
        return result;
    }

}
