{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/safetyculture/json-schema/safetyculture-s12-contractors-v1-list-company-documents-request-schema.json",
  "title": "s12.contractors.v1.ListCompanyDocumentsRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/safetyculture-companies-api-openapi.yml#/components/schemas/s12.contractors.v1.ListCompanyDocumentsRequest",
  "type": "object",
  "properties": {
    "company_id": {
      "type": "string",
      "description": "Required. The ID of the contractor company."
    },
    "filter": {
      "$ref": "#/$defs/s12.contractors.v1.CompanyDocumentsFilter"
    },
    "sort_field": {
      "description": "The field to sort by.",
      "allOf": [
        {
          "$ref": "#/$defs/s12.contractors.v1.CompanyDocumentSortField"
        }
      ]
    },
    "sort_direction": {
      "description": "The sort order.",
      "allOf": [
        {
          "$ref": "#/$defs/s12.common.SortDirection"
        }
      ]
    },
    "page_size": {
      "type": "integer",
      "format": "int32",
      "description": "The number of results to return in a single request."
    },
    "page_token": {
      "type": "string",
      "description": "If present, will fetch the next page of results. This must be the value of `next_page_token` from the response."
    },
    "search": {
      "$ref": "#/$defs/s12.contractors.v1.Search"
    }
  },
  "required": [
    "company_id"
  ],
  "$defs": {
    "s12.common.ExpiryStatus": {
      "type": "string",
      "enum": [
        "EXPIRY_STATUS_VALID",
        "EXPIRY_STATUS_EXPIRED",
        "EXPIRY_STATUS_EXPIRING_SOON"
      ],
      "description": "The expiry status of an object based on its validity period."
    },
    "s12.common.SortDirection": {
      "type": "string",
      "enum": [
        "SORT_DIRECTION_UNSPECIFIED",
        "SORT_DIRECTION_ASC",
        "SORT_DIRECTION_DESC"
      ],
      "default": "SORT_DIRECTION_UNSPECIFIED",
      "title": "Common set of sorting directions as used by lists"
    },
    "s12.contractors.v1.CompanyDocumentSortField": {
      "type": "string",
      "enum": [
        "DOCUMENT_SORT_FIELD_CREATED_AT",
        "DOCUMENT_SORT_FIELD_MODIFIED_AT",
        "DOCUMENT_SORT_FIELD_TITLE",
        "DOCUMENT_SORT_FIELD_FILE_NAME",
        "DOCUMENT_SORT_FIELD_TYPE",
        "DOCUMENT_SORT_FIELD_ISSUE_DATE",
        "DOCUMENT_SORT_FIELD_EXPIRATION_DATE",
        "DOCUMENT_SORT_FIELD_EXPIRY_STATUS"
      ],
      "title": "- DOCUMENT_SORT_FIELD_CREATED_AT: The time the document was created at\n - DOCUMENT_SORT_FIELD_MODIFIED_AT: The time the document was modified at\n - DOCUMENT_SORT_FIELD_TITLE: The title of the document\n - DOCUMENT_SORT_FIELD_FILE_NAME: The file name of the document\n - DOCUMENT_SORT_FIELD_TYPE: The type of the document\n - DOCUMENT_SORT_FIELD_ISSUE_DATE: The issue date of the document\n - DOCUMENT_SORT_FIELD_EXPIRATION_DATE: The expiration date of the document\n - DOCUMENT_SORT_FIELD_EXPIRY_STATUS: The expiry status of the document"
    },
    "s12.contractors.v1.CompanyDocumentsFilter": {
      "type": "object",
      "properties": {
        "is_archived": {
          "type": "boolean",
          "description": "Filter by archived status. Default is unarchived only."
        },
        "type_ids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Filter by document type. If not provided, all types are returned."
        },
        "approval_statuses": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/s12.documents.v1.ApprovalStatus"
          },
          "description": "Filter by the approval status of the document. If not provided, all statuses are returned."
        },
        "doc_expiry_statuses": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/s12.common.ExpiryStatus"
          },
          "description": "Filter by the expiry status of the document. If not provided, all statuses are returned."
        },
        "modified_at": {
          "description": "Filter by the modified at timestamp of the document. If not provided, all documents are returned.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.documents.v1.Duration"
            }
          ]
        }
      }
    },
    "s12.contractors.v1.Search": {
      "type": "object",
      "properties": {
        "value": {
          "type": "string"
        }
      },
      "title": "Search on a Company Document's name"
    },
    "s12.documents.v1.ApprovalStatus": {
      "type": "string",
      "enum": [
        "APPROVAL_STATUS_UNSPECIFIED",
        "APPROVAL_STATUS_PENDING",
        "APPROVAL_STATUS_APPROVED",
        "APPROVAL_STATUS_REJECTED"
      ],
      "default": "APPROVAL_STATUS_UNSPECIFIED"
    },
    "s12.documents.v1.Duration": {
      "type": "object",
      "properties": {
        "from": {
          "type": "string",
          "format": "date-time",
          "description": "optional. represents the time should be after the time provided"
        },
        "to": {
          "type": "string",
          "format": "date-time",
          "description": "optional. represents the time should be before the time provided"
        }
      }
    }
  }
}