// Path: src/main/java/com/github/kislayverma/rulette/rest/exception/RuleNotFoundException.java
// @ResponseStatus(value= HttpStatus.NOT_FOUND, reason="No rule found for the given input")
// public class RuleNotFoundException extends RuntimeException {
// 
//     public RuleNotFoundException(String msg) {
//         super(msg);
//     }
// 
//     public RuleNotFoundException(Throwable e) {
//         super(e);
//     }
// 
//     public RuleNotFoundException(String msg, Throwable e) {
//         super(msg, e);
//     }
// }
// 
// Path: src/main/java/com/github/kislayverma/rulette/rest/exception/RuleSystemNotFoundException.java
// @ResponseStatus(value= HttpStatus.NOT_FOUND, reason="No such rule system found")
// public class RuleSystemNotFoundException extends RuntimeException {
// 
//     public RuleSystemNotFoundException(String msg) {
//         super(msg);
//     }
// 
//     public RuleSystemNotFoundException(Throwable e) {
//         super(e);
//     }
// 
//     public RuleSystemNotFoundException(String msg, Throwable e) {
//         super(msg, e);
//     }
// }
// 
// Path: src/main/java/com/github/kislayverma/rulette/rest/api/rulesystem/RuleSystemMetadataDto.java
// public class RuleSystemMetadataDto implements Serializable {
//     private String ruleSystemName;
//     private String tableName;
//     private List<RuleInputMetaData> inputColumnList;
//     private String uniqueIdColumnName;
//     private String uniqueOutputColumnName;
//     private String providerName;
// 
//     @Override
//     public String toString() {
//         return "RuleSystemMetadataDto{" +
//             "ruleSystemName='" + ruleSystemName + '\'' +
//             ", tableName='" + tableName + '\'' +
//             ", inputColumnList=" + inputColumnList +
//             ", uniqueIdColumnName='" + uniqueIdColumnName + '\'' +
//             ", uniqueOutputColumnName='" + uniqueOutputColumnName + '\'' +
//             ", providerName='" + providerName + '\'' +
//             '}';
//     }
// 
//     public String getProviderName() {
//         return providerName;
//     }
// 
//     public void setProviderName(String providerName) {
//         this.providerName = providerName;
//     }
// 
//     public String getRuleSystemName() {
//         return ruleSystemName;
//     }
// 
//     public void setRuleSystemName(String ruleSystemName) {
//         this.ruleSystemName = ruleSystemName;
//     }
// 
//     public String getTableName() {
//         return tableName;
//     }
// 
//     public void setTableName(String tableName) {
//         this.tableName = tableName;
//     }
// 
//     public List<RuleInputMetaData> getInputColumnList() {
//         return inputColumnList;
//     }
// 
//     public void setInputColumnList(List<RuleInputMetaData> inputColumnList) {
//         this.inputColumnList = inputColumnList;
//     }
// 
//     public String getUniqueIdColumnName() {
//         return uniqueIdColumnName;
//     }
// 
//     public void setUniqueIdColumnName(String uniqueIdColumnName) {
//         this.uniqueIdColumnName = uniqueIdColumnName;
//     }
// 
//     public String getUniqueOutputColumnName() {
//         return uniqueOutputColumnName;
//     }
// 
//     public void setUniqueOutputColumnName(String uniqueOutputColumnName) {
//         this.uniqueOutputColumnName = uniqueOutputColumnName;
//     }
// }


import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.kislayverma.rulette.RuleSystem;
import com.github.kislayverma.rulette.core.metadata.RuleInputMetaData;
import com.github.kislayverma.rulette.core.metadata.RuleSystemMetaData;
import com.github.kislayverma.rulette.core.rule.Rule;
import com.github.kislayverma.rulette.core.ruleinput.type.RuleInputType;
import com.github.kislayverma.rulette.rest.exception.RuleNotFoundException;
import com.github.kislayverma.rulette.rest.exception.RuleSystemNotFoundException;
import com.github.kislayverma.rulette.rest.api.rulesystem.RuleSystemMetadataDto;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
package com.github.kislayverma.rulette.rest.utils;



public class TransformerUtil {
    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

    public static Map<String, String> convertToRawValueMap(final RuleSystem ruleSystem, final Rule rule) {
        if (ruleSystem == null) {
            throw new RuleSystemNotFoundException("No rule system defined for transforming rule to Rule DTO");
        } else if (rule == null) {
            throw new RuleNotFoundException("No rule defined for transforming to DTO");
        }

        final Map<String, String> ruleValues = new HashMap<>();
        ruleSystem.getAllColumnNames()
            .forEach(columnName -> {
// Path: src/main/java/com/github/kislayverma/rulette/rest/exception/RuleNotFoundException.java
// @ResponseStatus(value= HttpStatus.NOT_FOUND, reason="No rule found for the given input")
// public class RuleNotFoundException extends RuntimeException {
// 
//     public RuleNotFoundException(String msg) {
//         super(msg);
//     }
// 
//     public RuleNotFoundException(Throwable e) {
//         super(e);
//     }
// 
//     public RuleNotFoundException(String msg, Throwable e) {
//         super(msg, e);
//     }
// }
// 
// Path: src/main/java/com/github/kislayverma/rulette/rest/exception/RuleSystemNotFoundException.java
// @ResponseStatus(value= HttpStatus.NOT_FOUND, reason="No such rule system found")
// public class RuleSystemNotFoundException extends RuntimeException {
// 
//     public RuleSystemNotFoundException(String msg) {
//         super(msg);
//     }
// 
//     public RuleSystemNotFoundException(Throwable e) {
//         super(e);
//     }
// 
//     public RuleSystemNotFoundException(String msg, Throwable e) {
//         super(msg, e);
//     }
// }
// 
// Path: src/main/java/com/github/kislayverma/rulette/rest/api/rulesystem/RuleSystemMetadataDto.java
// public class RuleSystemMetadataDto implements Serializable {
//     private String ruleSystemName;
//     private String tableName;
//     private List<RuleInputMetaData> inputColumnList;
//     private String uniqueIdColumnName;
//     private String uniqueOutputColumnName;
//     private String providerName;
// 
//     @Override
//     public String toString() {
//         return "RuleSystemMetadataDto{" +
//             "ruleSystemName='" + ruleSystemName + '\'' +
//             ", tableName='" + tableName + '\'' +
//             ", inputColumnList=" + inputColumnList +
//             ", uniqueIdColumnName='" + uniqueIdColumnName + '\'' +
//             ", uniqueOutputColumnName='" + uniqueOutputColumnName + '\'' +
//             ", providerName='" + providerName + '\'' +
//             '}';
//     }
// 
//     public String getProviderName() {
//         return providerName;
//     }
// 
//     public void setProviderName(String providerName) {
//         this.providerName = providerName;
//     }
// 
//     public String getRuleSystemName() {
//         return ruleSystemName;
//     }
// 
//     public void setRuleSystemName(String ruleSystemName) {
//         this.ruleSystemName = ruleSystemName;
//     }
// 
//     public String getTableName() {
//         return tableName;
//     }
// 
//     public void setTableName(String tableName) {
//         this.tableName = tableName;
//     }
// 
//     public List<RuleInputMetaData> getInputColumnList() {
//         return inputColumnList;
//     }
// 
//     public void setInputColumnList(List<RuleInputMetaData> inputColumnList) {
//         this.inputColumnList = inputColumnList;
//     }
// 
//     public String getUniqueIdColumnName() {
//         return uniqueIdColumnName;
//     }
// 
//     public void setUniqueIdColumnName(String uniqueIdColumnName) {
//         this.uniqueIdColumnName = uniqueIdColumnName;
//     }
// 
//     public String getUniqueOutputColumnName() {
//         return uniqueOutputColumnName;
//     }
// 
//     public void setUniqueOutputColumnName(String uniqueOutputColumnName) {
//         this.uniqueOutputColumnName = uniqueOutputColumnName;
//     }
// }


// Path: src/main/java/com/github/kislayverma/rulette/rest/utils/TransformerUtil.java
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.kislayverma.rulette.RuleSystem;
import com.github.kislayverma.rulette.core.metadata.RuleInputMetaData;
import com.github.kislayverma.rulette.core.metadata.RuleSystemMetaData;
import com.github.kislayverma.rulette.core.rule.Rule;
import com.github.kislayverma.rulette.core.ruleinput.type.RuleInputType;
import com.github.kislayverma.rulette.rest.exception.RuleNotFoundException;
import com.github.kislayverma.rulette.rest.exception.RuleSystemNotFoundException;
import com.github.kislayverma.rulette.rest.api.rulesystem.RuleSystemMetadataDto;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

package com.github.kislayverma.rulette.rest.utils;



public class TransformerUtil {
    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

    public static Map<String, String> convertToRawValueMap(final RuleSystem ruleSystem, final Rule rule) {
        if (ruleSystem == null) {
            throw new RuleSystemNotFoundException("No rule system defined for transforming rule to Rule DTO");
        } else if (rule == null) {
            throw new RuleNotFoundException("No rule defined for transforming to DTO");
        }

        final Map<String, String> ruleValues = new HashMap<>();
        ruleSystem.getAllColumnNames()
            .forEach(columnName -> {
                ruleValues.put(columnName, rule.getColumnData(columnName).getRawValue());