{
  "type": "tradle.Model",
  "title": "Application",
  "shortTitle": "App",
  "id": "tradle.Application",
  "properties": {
    "applicantName": {
      "type": "string",
      "displayName": true,
      "readOnly": true
    },
    "applicant": {
      "type": "object",
      "ref": "tradle.Identity",
      "readOnly": true
    },
    "relationshipManagers": {
      "type": "array",
      "readOnly": true,
      "hidden": true,
      "items": {
        "ref": "tradle.Identity"
      }
    },
    "analyst": {
      "type": "object",
      "readOnly": true,
      "ref": "tradle.MyEmployeeOnboarding"
    },
    "submittedBy": {
      "type": "object",
      "readOnly": true,
      "ref": "tradle.MyEmployeeOnboarding"
    },
    "counterparty": {
      "type": "object",
      "ref": "tradle.Counterparty"
    },
    "decisionBy": {
      "type": "object",
      "readOnly": true,
      "ref": "tradle.MyEmployeeOnboarding"
    },
    "decisionDate": {
      "type": "date",
      "readOnly": true
    },
    "reviewer": {
      "type": "object",
      "hidden": true,
      "readOnly": true,
      "ref": "tradle.Identity"
    },
    "status": {
      "type": "string",
      "readOnly": true
    },
    "manualEdit": {
      "type": "boolean",
      "readOnly": true
    },
    "dateStarted": {
      "type": "date",
      "shortTitle": "start",
      "readOnly": true
    },
    "dateCompleted": {
      "type": "date",
      "readOnly": true
    },
    "dateEvaluated": {
      "type": "date",
      "readOnly": true
    },
    "dateModified": {
      "type": "date",
      "readOnly": true
    },
    "context": {
      "type": "string",
      "readOnly": true
    },
    "request": {
      "type": "object",
      "ref": "tradle.Form",
      "readOnly": true
    },
    "requestFor": {
      "type": "string",
      "range": "model",
      "displayName": true,
      "readOnly": true
    },
    "filledForCustomer": {
      "type": "boolean",
      "readOnly": true
    },
    "submissions": {
      "type": "array",
      "items": {
        "ref": "tradle.ApplicationSubmission",
        "backlink": "application"
      }
    },
    "assignedToTeam": {
      "type": "object",
      "ref": "tradle.ClientOnboardingTeam"
    },
    "teamCode": {
      "type": "object",
      "ref": "tradle.TeamCode"
    },
    "relationshipOwner": {
      "type": "string"
    },
    "clientMetInPerson": {
      "type": "boolean",
      "range": "troolean"
    },
    "personClientMet": {
      "type": "string",
      "showIf": "clientMetInPerson && clientMetInPerson = true"
    },
    "reasonClientNotMet": {
      "type": "string",
      "showIf": "clientMetInPerson && clientMetInPerson = false"
    },
    "clientPremisesVisited": {
      "type": "boolean",
      "range": "troolean"
    },
    "personPremisesVisited": {
      "type": "string",
      "showIf": "clientPremisesVisited && clientPremisesVisited = true"
    },
    "reasonPremisesNotVisited": {
      "type": "string",
      "showIf": "clientPremisesVisited && clientPremisesVisited = false"
    },
    "report": {
      "type": "object",
      "range": "document",
      "allowPicturesFromLibrary": true,
      "inlined": true,
      "ref": "tradle.Photo"
    },
    "submittedFormTypesCount": {
      "type": "number",
      "readOnly": true
    },
    "maxFormTypesCount": {
      "type": "number",
      "readOnly": true
    },
    "attestations": {
      "type": "array",
      "items": {
        "ref": "tradle.Attestation",
        "backlink": "parentApplication"
      }
    },
    "forms": {
      "type": "array",
      "icon": "logo-buffer",
      "items": {
        "ref": "tradle.ApplicationSubmission",
        "backlink": "application",
        "filter": {
          "SUBCLASS_OF": {
            "submission._t": ["tradle.Form"]
          }
        }
      }
    },
    "editRequests": {
      "type": "array",
      "icon": "ios-create-outline",
      "items": {
        "ref": "tradle.ApplicationSubmission",
        "backlink": "application",
        "filter": {
          "EQ": {
            "submission._t": "tradle.FormError"
          }
        }
      }
    },
    "products": {
      "type": "array",
      "title": "Permits",
      "icon": "ios-color-filter-outline",
      "items": {
        "ref": "tradle.ApplicationSubmission",
        "backlink": "application",
        "filter": {
          "SUBCLASS_OF": {
            "submission._t": ["tradle.MyProduct"]
          }
        }
      }
    },
    "verifications": {
      "type": "array",
      "icon": "ios-ribbon-outline",
      "hidden": true,
      "items": {
        "ref": "tradle.ApplicationSubmission",
        "backlink": "application",
        "filter": {
          "EQ": {
            "submission._t": "tradle.Verification"
          }
        }
      }
    },
    "checks": {
      "type": "array",
      "items": {
        "ref": "tradle.Check",
        "backlink": "application"
      }
    },
    "checksOverride": {
      "type": "array",
      "hidden": true,
      "items": {
        "ref": "tradle.CheckOverride",
        "backlink": "application"
      }
    },
    "notifications": {
      "type": "array",
      "icon": "ios-notifications-outline",
      "items": {
        "ref": "tradle.Notification",
        "backlink": "application"
      }
    },
    "requestErrors": {
      "type": "array",
      "icon": "ios-open-outline",
      "hidden": true,
      "items": {
        "ref": "tradle.ApplicationSubmission",
        "backlink": "application",
        "filter": {
          "EQ": {
            "submission._t": "tradle.RequestError"
          }
        }
      }
    },
    "parent": {
      "type": "object",
      "title": "Parent application",
      "readOnly": true,
      "ref": "tradle.Application"
    },
    "top": {
      "type": "object",
      "title": "Root application",
      "readOnly": true,
      "ref": "tradle.Application"
    },
    "fromDraft": {
      "type": "object",
      "title": "Draft application",
      "readOnly": true,
      "ref": "tradle.Application"
    },
    "associatedResource": {
      "type": "object",
      "ref": "tradle.Object",
      "readOnly": true
    },
    "items": {
      "type": "array",
      "icon": "ios-browsers-outline",
      "readOnly": true,
      "items": {
        "ref": "tradle.Application",
        "backlink": "parent"
      }
    },
    "creditScore": {
      "type": "object",
      "ref": "tradle.CreditScore"
    },
    "certificate": {
      "type": "object",
      "ref": "tradle.MyProduct",
      "readOnly": true
    },
    "archived": {
      "type": "boolean",
      "readOnly": true
    },
    "moveToArchive": {
      "type": "boolean"
    },
    "draft": {
      "type": "boolean",
      "readOnly": true,
      "description": "true if this is a draft for another application"
    },
    "draftCompleted": {
      "type": "boolean",
      "readOnly": true
    },
    "prefillFromApplication": {
      "type": "object",
      "ref": "tradle.Application",
      "readOnly": true
    },
    "numberOfChecksFailed": {
      "type": "number",
      "readOnly": true
    },
    "hasFailedChecks": {
      "type": "boolean",
      "readOnly": true
    },
    "numberOfCheckOverrides": {
      "type": "number",
      "readOnly": true
    },
    "hasCheckOverrides": {
      "type": "boolean",
      "readOnly": true
    },
    "hasFailedScreeningChecks": {
      "type": "boolean",
      "readOnly": true
    },
    "hasFailedDocumentValidityChecks": {
      "type": "boolean",
      "readOnly": true
    },
    "hasFailedEntityExistanceChecks": {
      "type": "boolean",
      "readOnly": true
    },
    "pepHit": {
      "type": "boolean",
      "readOnly": true
    },
    "sanctionsHit": {
      "type": "boolean",
      "readOnly": true
    },
    "adverseMediaHit": {
      "type": "boolean",
      "readOnly": true
    },
    "screeningCheckCount": {
      "type": "number",
      "readOnly": true
    },
    "lastMsgToClientTime": {
      "type": "date",
      "readOnly": true
    },
    "lastMsgFromClientTime": {
      "type": "date",
      "readOnly": true
    },
    "score": {
      "type": "number",
      "shortTitle": "IRR",
      "readOnly": true
    },
    "ruledBasedScore": {
      "type": "number",
      "title": "Rule-based Score",
      "readOnly": true
    },
    "scoreType": {
      "type": "object",
      "ref": "tradle.ScoreType",
      "title": "Risk Category"
    },
    "previousScoreType": {
      "type": "object",
      "ref": "tradle.ScoreType",
      "title": "Risk Category"
    },
    "scoreDetails": {
      "type": "object",
      "range": "json",
      "readOnly": true
    },
    "creditScoreDetails": {
      "type": "object",
      "range": "json",
      "readOnly": true
    },
    "ddr": {
      "type": "string",
      "title": "DDR"
    },
    "bsa": {
      "type": "string",
      "title": "BSA"
    },
    "tree": {
      "type": "object",
      "range": "json",
      "readOnly": true
    },
    "dataBundle": {
      "type": "string",
      "readOnly": true
    },
    "processingDataBundle": {
      "type": "boolean",
      "readOnly": true
    },
    "formsCount": {
      "type": "number",
      "readOnly": true
    },
    "checksCount": {
      "type": "number",
      "readOnly": true
    },
    "itemsCount": {
      "type": "number",
      "readOnly": true
    },
    "editRequestsCount": {
      "type": "number",
      "readOnly": true
    },
    "notificationsCount": {
      "type": "number",
      "readOnly": true
    },
    "notifyByRulesCount": {
      "type": "number",
      "readOnly": true
    },
    "enterpriseClassification": {
      "type": "string"
    },
    "FCAClassification": {
      "type": "string",
      "title": "FCA Classification"
    },
    "PSRClassification": {
      "type": "string",
      "title": "PSR Classification"
    },
    "eligibleComplainantClassification": {
      "type": "string"
    },
    "FSCSClassification": {
      "type": "string",
      "title": "FSCS Classification"
    },
    "UKClientSectorCode": {
      "type": "string",
      "title": "UK Client Sector Code"
    },
    "UKClientIndustryCode": {
      "type": "string",
      "title": "UK Client Industry Code"
    },
    "conversation": {
      "type": "object",
      "range": "json",
      "readOnly": true
    },
    "mifidClassification": {
      "type": "string",
      "title": "MiFID Classification"
    },
    "summary_group": {
      "type": "string",
      "title": "Summary",
      "list": [
        "applicantName",
        "status",
        "manualEdit",
        "draft",
        "draftCompleted",
        "dateStarted",
        "dateModified",
        "dateCompleted",
        "forms"
      ]
    },
    "score_group": {
      "type": "string",
      "title": "Score Details",
      "list": [
        "score",
        "ruledBasedScore",
        "scoreType",
        "creditScore",
        "scoreDetails",
        "creditScoreDetails"
      ]
    },
    "screening_group": {
      "type": "string",
      "title": "Screening Details",
      "list": [
        "hasFailedScreeningChecks",
        "sanctionsHit",
        "pepHit",
        "adverseMediaHit",
        "hasFailedDocumentValidityChecks",
        "hasFailedEntityExistanceChecks"
      ]
    },
    "checks_group": {
      "type": "string",
      "title": "Check Details",
      "list": [
        "numberOfChecksFailed",
        "hasFailedChecks",
        "numberOfChecksFailed",
        "hasCheckOverrides",
        "numberOfCheckOverrides",
        "checks"
      ]
    },
    "relationship_group": {
      "type": "string",
      "title": "Relationship",
      "list": [
        "assignedToTeam",
        "teamCode",
        "analyst",
        "relationshipOwner",
        "clientMetInPerson",
        "personClientMet",
        "reasonClientNotMet",
        "clientPremisesVisited",
        "personPremisesVisited",
        "reasonPremisesNotVisited",
        "submittedBy",
        "counterparty"
      ]
    },
    "other_group": {
      "type": "string",
      "title": "Other Details",
      "list": [
        "lastMsgFromClientTime",
        "lastMsgToClientTime",
        "archived",
        "moveToArchive",
        "parent",
        "decisionBy",
        "decisionDate",
        "tree",
        "products",
        "attestations",
        "editRequests"
      ]
    }
  },

  "gridCols": [
    "applicantName",
    "status",
    "requestFor",
    "score",
    "analyst",
    "dateStarted",
    "numberOfChecksFailed",
    "numberOfCheckOverrides",
    "submittedBy",
    "counterparty"
  ],
  "editCols": [
    "summary_group",
    "score_group",
    "screening_group",
    "checks_group",
    "relationship_group",
    "other_group"
  ],
  "viewCols": [
    "summary_group",
    "score_group",
    "screening_group",
    "checks_group",
    "relationship_group",
    "other_group"
  ],
  "required": ["applicant", "requestFor", "context"],
  "indexes": [
    {
      "hashKey": "context",
      "specificity": 5
    },
    {
      "hashKey": "applicant._permalink",
      "rangeKey": "_time",
      "specificity": 4
    },
    {
      "hashKey": "_t",
      "rangeKey": "_time",
      "specificity": 1
    },
    {
      "hashKey": "status",
      "rangeKey": ["requestFor", "_time"],
      "specificity": 3
    },
    {
      "hashKey": "assignedToTeam.id",
      "rangeKey": "_time",
      "specificity": 4
    },
    {
      "hashKey": "analyst._permalink",
      "rangeKey": "_time",
      "specificity": 4
    }
  ]
}
