import TestCase from "@business-logic/types/TestCase";
import { Rule } from "../types/RuleEngine";
import EnumUtils from "../../impl/utils/EnumUtils";

// File containing Rule Engine Builtin Rules for JSON Data Validation

export enum BuiltInRules {
    //Custom Rules
}

// Built-Ins shouldn't depend on other rules, custom rules however are supposed to depend on them
export const builtInRules: Rule<TestCase>[] = 
[
//{
//     id: BuiltInRules.TransactionExists,
//     name: "Transaction Exists Rule",
//     check: (testCase: TestCase) => {
//         return testCase.transaction != null;
//     }
// }, {
//     id: BuiltInRules.PricingExists,
//     name: "Pricing must exist on Transaction Rule",
//     check: (testCase: TestCase) => {
//         return testCase.transaction != null && testCase.transaction.pricing != null;
//     }
// }, {
//     id: BuiltInRules.TerminationIsMod,
//     name: "OpportunityType Termination requires TransactionSubType Mod",
//     check: (testCase: TestCase) => {

//         // Check old transactions
//         for (var transaction of testCase.oldTransactions) {
//             if (transaction.opportunityType == OpportunityTypes.Termination)
//                 return transaction.subType == TransactionSubTypes.Mod;
//         }

//         // Check transaction
//         if (testCase.transaction.opportunityType == OpportunityTypes.Termination)
//             return testCase.transaction.subType == TransactionSubTypes.Mod;
//         return true;
//     },
//     dependsOn: [BuiltInRules.TransactionExists]
// }, {
];