<commit_before>import { JSONSchema6 } from "json-schema";
import mergeJson from "merge-json";
import rewardApiInput from "../RewardApiInput.schema.json";
import userIdentifier from "../UserIdentifier.schema.json";

const referralImport: JSONSchema6 = {
  $schema: "http://json-schema.org/draft-06/schema#",
  type: "object",
  properties: {
    referral: {
      type: "object",
      title: "Referred By Referral",
      properties: {
        referrerUser: {
          ...(<JSONSchema6>userIdentifier)
        },
        referredUser: {
          ...(<JSONSchema6>userIdentifier)
        },
        programId: {
          type: "string",
          title: "Program Id"
        },
        dateReferralStarted: {
          type: "integer",
          title: "Date Referral Started"
        },
        dateConverted: {
          type: "integer",
          title: "Date Converted"
        },
        rewards: {
          $ref: "#/definitions/rewards"
        }
      }
    }
  },
  definitions: {
    ...(<JSONSchema6>rewardApiInput).definitions,
    rewards: {
      type: "array",
      title: "Rewards",
      items: {
        ...mergeJson.merge((<JSONSchema6>rewardApiInput).properties, {
          type: "object",
          properties: {
            programRewardKey: {
              type: "string",
              title: "Reward Key"
            },
            dateGiven: {
              type: "integer",
              title: "Date Given"
            },
            redemptions: {
              $ref: "#/definitions/redemptions"
            }
          }
        })
      }
    },
    redemptions: {
      type: "array",
      title: "Redemptions",
      items: {
        type: "object",
        properties: {
          quantityRedeemed: {
            type: "integer",
            title: "Redeemed Amount"
          },
          dateRedeemed: {
            type: "integer",
            title: "Date Redeemed"
          }
        }
      }
    }
  }
};

export default referralImport;<commit_msg>EM generating referral import with pre-existing reward api input schema<commit_after>import { JSONSchema6 } from "json-schema";
import mergeJson from "merge-json";
import rewardApiInput from "../RewardApiInput.schema.json";
import userIdentifier from "../UserIdentifier.schema.json";

const rewardInput: JSONSchema6 = mergeJson.merge(
  {
    properties: {
      type: "object",
      ...(<JSONSchema6>rewardApiInput).properties
    },
    dependencies: {
        ...(<JSONSchema6>rewardApiInput).dependencies
    }
  },
  {
    properties: {
      programRewardKey: {
        type: "string",
        title: "Reward Key"
      },
      dateGiven: {
        type: "integer",
        title: "Date Given"
      },
      redemptions: {
        $ref: "#/definitions/redemptions"
      }
    }
  }
);

const referralImport: JSONSchema6 = {
  $schema: "http://json-schema.org/draft-06/schema#",
  type: "object",
  properties: {
    referral: {
      type: "object",
      title: "Referred By Referral",
      properties: {
        referrerUser: {
          ...(<JSONSchema6>userIdentifier)
        },
        referredUser: {
          ...(<JSONSchema6>userIdentifier)
        },
        programId: {
          type: "string",
          title: "Program Id"
        },
        dateReferralStarted: {
          type: "integer",
          title: "Date Referral Started"
        },
        dateConverted: {
          type: "integer",
          title: "Date Converted"
        },
        rewards: {
          $ref: "#/definitions/rewards"
        }
      }
    }
  },
  definitions: {
    ...(<JSONSchema6>rewardApiInput).definitions,
    rewards: {
      type: "array",
      title: "Rewards",
      items: {
        ...rewardInput
      }
    },
    redemptions: {
      type: "array",
      title: "Redemptions",
      items: {
        type: "object",
        properties: {
          quantityRedeemed: {
            type: "integer",
            title: "Redeemed Amount"
          },
          dateRedeemed: {
            type: "integer",
            title: "Date Redeemed"
          }
        }
      }
    }
  }
};

export default referralImport;
{'fraction_non_alphanumeric': 0.13065569804016453, 'fraction_numerical': 0.004355189934672151, 'mean_word_length': 1.628099173553719, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4808970', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1209, 'n_words': 234}