$schema: https://json-schema.org/draft/2020-12/schema
$id: ApplicationBase.yaml
type: object
properties:
  id:
    $ref: uuid.yaml
    description: The unique identifier for the application
  name:
    type: string
    description: The name of the application
  competitionId:
    $ref: uuid.yaml
    description: The unique identifier for the competition
  formResponses:
    $ref: '#/$defs/RecordAppFormResponse'
    description: The form responses for the application
  status:
    $ref: AppStatus.yaml
    description: The status of the application
  submittedAt:
    anyOf:
      - type: string
        format: date-time
      - type: 'null'
    description: The date and time the application was submitted
  validationErrors:
    type: array
    items: {}
    description: The validation errors for the application and form responses
  customFields:
    $ref: '#/$defs/RecordCustomField'
    description: The custom fields about the application
  createdAt:
    type: string
    format: date-time
    description: The timestamp (in UTC) at which the record was created.
  lastModifiedAt:
    type: string
    format: date-time
    description: The timestamp (in UTC) at which the record was last modified.
required:
  - id
  - name
  - competitionId
  - formResponses
  - status
  - createdAt
  - lastModifiedAt
unevaluatedProperties:
  not: {}
examples:
  - id: 123e4567-e89b-12d3-a456-426614174000
    name: My Application
    competitionId: 123e4567-e89b-12d3-a456-426614174000
    opportunityId: ad3b469a-d89a-42d3-c439-6c1234567890
    formResponses:
      formA:
        applicationId: 123e4567-e89b-12d3-a456-426614174000
        id: 123e4567-e89b-12d3-a456-426614174000
        formId: 123e4567-e89b-12d3-a456-426614174000
        response:
          firstName: John
          lastName: Doe
          email: john.doe@example.com
          phone: 123-456-7890
          address:
            street: 123 Main St
            city: Anytown
            state: CA
            zip: '12345'
            country: null
        status:
          value: inProgress
          description: The form response is in progress
        validationErrors:
          - field: address.country
            message: Country is required
        createdAt: '2021-01-01T00:00:00.000Z'
        lastModifiedAt: '2021-01-01T00:00:00.000Z'
    status:
      value: inProgress
      description: The application is in progress.
    submittedAt: null
    createdAt: '2021-01-01T00:00:00.000Z'
    lastModifiedAt: '2021-01-01T00:00:00.000Z'
    customFields:
      attachments:
        name: attachments
        fieldType: object
        value:
          contacts:
            downloadUrl: https://example.com/file.pdf
            name: example.pdf
            description: A PDF file with instructions
            sizeInBytes: 1000
            mimeType: application/pdf
            createdAt: '2025-01-01T17:01:01.000Z'
            lastModifiedAt: '2025-01-02T17:30:00.000Z'
          budget:
            downloadUrl: https://example.com/excel.xlsx
            name: excel.xlsx
            description: The excel file for the application
            sizeInBytes: 1000
            mimeType: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
            createdAt: '2025-01-01T17:01:01.000Z'
            lastModifiedAt: '2025-01-02T17:30:00.000Z'
        description: The attachments for the application
      applicationZipFile:
        name: applicationZipFile
        fieldType: object
        value:
          downloadUrl: https://example.com/application.zip
          name: application.zip
          description: The zip file for the application
          sizeInBytes: 50000
          mimeType: application/zip
          createdAt: '2025-01-01T17:01:01.000Z'
          lastModifiedAt: '2025-01-02T17:30:00.000Z'
        description: The zip file for the application
description: The base model for an application to a competition for a funding opportunity
$defs:
  RecordAppFormResponse:
    type: object
    properties: {}
    unevaluatedProperties:
      $ref: AppFormResponse.yaml
  RecordCustomField:
    type: object
    properties: {}
    unevaluatedProperties:
      $ref: CustomField.yaml
