{
  "type": "tradle.Model",
  "title": "Application",
  "id": "tradle.Application",
  "properties": {
    "applicantName": {
      "type": "string"
    },
    "applicant": {
      "type": "object",
      "ref": "tradle.Identity"
    },
    "relationshipManagers": {
      "type": "array",
      "items": {
        "ref": "tradle.Identity"
      }
    },
    "status": {
      "type": "string",
      "skipLabel": true
    },
    "dateStarted": {
      "type": "date"
    },
    "dateCompleted": {
      "type": "date"
    },
    "dateEvaluated": {
      "type": "date"
    },
    "dateModified": {
      "type": "date"
    },
    "context": {
      "type": "string"
    },
    "request": {
      "type": "object",
      "ref": "tradle.Form"
    },
    "requestFor": {
      "type": "string",
      "range": "model",
      "displayName": true
    },
    "submissions": {
      "type": "array",
      "items": {
        "ref": "tradle.ApplicationSubmission",
        "backlink": "application"
      }
    },
    "forms": {
      "type": "array",
      "items": {
        "ref": "tradle.ApplicationSubmission",
        "backlink": "application",
        "filter": {
          "SUBCLASS_OF": {
            "submission._t": ["tradle.Form"]
          }
        }
      }
    },
    "editRequests": {
      "type": "array",
      "items": {
        "ref": "tradle.ApplicationSubmission",
        "backlink": "application",
        "filter": {
          "EQ": {
            "submission._t": "tradle.FormError"
          }
        }
      }
    },
    "products": {
      "type": "array",
      "items": {
        "ref": "tradle.ApplicationSubmission",
        "backlink": "application",
        "filter": {
          "SUBCLASS_OF": {
            "submission._t": ["tradle.MyProduct"]
          }
        }
      }
    },
    "verifications": {
      "type": "array",
      "items": {
        "ref": "tradle.ApplicationSubmission",
        "backlink": "application",
        "filter": {
          "EQ": {
            "submission._t": "tradle.Verification"
          }
        }
      }
    },
    "checks": {
      "type": "array",
      "items": {
        "ref": "tradle.Check",
        "backlink": "application"
      }
    },
    "certificate": {
      "type": "object",
      "ref": "tradle.MyProduct"
    },
    "archived": {
      "type": "boolean"
    },
    "draft": {
      "type": "boolean",
      "description": "true if this is a draft for another application"
    },
    "prefillFromApplication": {
      "type": "object",
      "ref": "tradle.Application"
    }
  },
  "viewCols": [
    "status",
    "applicantName",
    "requestFor",
    "dateStarted",
    "dateModified",
    "dateCompleted",
    "archived",
    "forms",
    "checks",
    "verifications",
    "editRequests",
    "products"
  ],
  "required": [
    "applicant",
    "requestFor",
    "context"
  ],
  "indexes": [
    "context",
    {
      "hashKey": "applicant._permalink",
      "rangeKey": "_time"
    },
    {
      "hashKey": "_t",
      "rangeKey": "_time"
    }
  ]
}
