{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/safetyculture/json-schema/safetyculture-s12-contractors-v1-update-contractor-company-request-schema.json",
  "title": "s12.contractors.v1.UpdateContractorCompanyRequest",
  "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.UpdateContractorCompanyRequest",
  "type": "object",
  "properties": {
    "company_type_id": {
      "type": "string",
      "description": "Required. The ID of the contractor company type."
    },
    "company_id": {
      "type": "string",
      "description": "Required. The ID of the contractor company."
    },
    "contractor_company_attributes": {
      "description": "The attributes of the contractor company.",
      "allOf": [
        {
          "$ref": "#/$defs/s12.contractors.v1.ContractorCompanyAttributes"
        }
      ]
    },
    "update_mask": {
      "type": "string",
      "description": "Required. The attributes (such as name etc.) you want to update for the contractor company. The contents should reference fields of the ContractorCompanyAttributes message.\nFor example, 'update_mask=name,contact_details.address' indicates that only the name and contact_details.address fields of the ContractorCompanyAttributes message should be updated. Any other attributes provided in the ContractorCompanyAttributes body will be ignored."
    }
  },
  "required": [
    "company_type_id",
    "company_id",
    "update_mask"
  ],
  "$defs": {
    "s12.common.Media": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "token": {
          "type": "string"
        },
        "filename": {
          "type": "string",
          "description": "full file name, including file extension"
        },
        "media_type": {
          "$ref": "#/$defs/s12.common.MediaType"
        }
      },
      "title": "Represents an image or video"
    },
    "s12.common.MediaType": {
      "type": "string",
      "enum": [
        "MEDIA_TYPE_IMAGE",
        "MEDIA_TYPE_VIDEO",
        "MEDIA_TYPE_PDF",
        "MEDIA_TYPE_DOCX",
        "MEDIA_TYPE_XLSX",
        "MEDIA_TYPE_PPTX",
        "MEDIA_TYPE_CSV"
      ],
      "description": " - MEDIA_TYPE_IMAGE: An image file (GIF, JPG, PNG, WEBP).\n - MEDIA_TYPE_VIDEO: A video file (MP4, MOV).\n - MEDIA_TYPE_PDF: A PDF document.\n - MEDIA_TYPE_DOCX: A Microsoft Word document (DOCX, DOC).\n - MEDIA_TYPE_XLSX: A Microsoft Excel spreadsheet (XLSX, XLS).\n - MEDIA_TYPE_PPTX: A Microsoft PowerPoint presentation (PPTX, PPT).\n - MEDIA_TYPE_CSV: A CSV file."
    },
    "s12.contractors.v1.Address": {
      "type": "object",
      "properties": {
        "sub_premise": {
          "type": "string",
          "description": "A first-order entity below a named location\neg. Building, floor level, or suite"
        },
        "street_number": {
          "type": "string",
          "description": "Street number"
        },
        "street": {
          "type": "string",
          "description": "Street name"
        },
        "city": {
          "type": "string",
          "description": "City or locality"
        },
        "administrative_area_level_2": {
          "type": "string",
          "description": "deprecated. For output, this will return the value of administrative_area_level for backward compatibility."
        },
        "administrative_area_level_1": {
          "type": "string",
          "description": "A first-order civil entity below the country level. These do not exist in all countries.\neg. within the United States: state or province, within the UK: county, within Australia: state"
        },
        "postal_code": {
          "type": "string",
          "description": "Postal code"
        },
        "country_code": {
          "type": "string",
          "description": "Country code (ISO 3166-1 alpha-2)"
        }
      }
    },
    "s12.contractors.v1.CompanyComplianceStatistics": {
      "type": "object",
      "properties": {
        "expired_document_count": {
          "type": "integer",
          "format": "int32",
          "description": "The number of company documents that have expired."
        },
        "expiring_soon_document_count": {
          "type": "integer",
          "format": "int32",
          "description": "The number of company documents that are expiring soon.\nThe service hard-codes \"expiring soon\" as documents that are expiring within the next 30 days."
        },
        "pending_approval_document_count": {
          "type": "integer",
          "format": "int32",
          "description": "The number of company documents that are pending approval."
        }
      },
      "description": "CompanyComplianceStatistics is a message that contains statistics about a contractor company's compliance."
    },
    "s12.contractors.v1.CompanyContactDetails": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "description": "The email address of the company."
        },
        "phone_number": {
          "type": "string",
          "description": "The phone number of the company."
        },
        "address": {
          "description": "The address of the company.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.contractors.v1.Address"
            }
          ]
        }
      },
      "description": "Contact details associated with a contractor company."
    },
    "s12.contractors.v1.CompanyUserCredentialComplianceStatistics": {
      "type": "object",
      "properties": {
        "expired_user_credential_count": {
          "type": "integer",
          "format": "int32",
          "description": "The number of user credentials that have expired."
        },
        "expiring_soon_user_credential_count": {
          "type": "integer",
          "format": "int32",
          "description": "The number of user credentials that are expiring soon."
        },
        "pending_approval_user_credential_count": {
          "type": "integer",
          "format": "int32",
          "description": "The number of user credentials that are pending approval."
        },
        "total_user_credential_count": {
          "type": "integer",
          "format": "int32",
          "description": "The total number of user credentials."
        }
      },
      "description": "CompanyUserCredentialComplianceStatistics is a message that contains statistics about a contractor company's users' credential compliance."
    },
    "s12.contractors.v1.ContractorCompanyAttributes": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the company."
        },
        "contact_details": {
          "description": "The contact details of the company.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.contractors.v1.CompanyContactDetails"
            }
          ]
        },
        "image": {
          "description": "Image to be associated with the company.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.common.Media"
            }
          ]
        },
        "external_reference_id": {
          "type": "string",
          "description": "An optional external reference ID for the company that is used in external systems. Enforces uniqueness."
        },
        "status": {
          "description": "The status of the company.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.contractors.v1.ContractorCompanyStatus"
            }
          ]
        },
        "compliance_statistics": {
          "description": "The compliance statistics of the company.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.contractors.v1.CompanyComplianceStatistics"
            }
          ]
        },
        "user_credential_compliance_statistics": {
          "description": "The user credential compliance statistics of the company.\nOnly populated for users with credential management permissions.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.contractors.v1.CompanyUserCredentialComplianceStatistics"
            }
          ]
        },
        "notes": {
          "type": "string",
          "description": "An internal note about the company, visible only to users with admin:companies permission."
        },
        "site_ids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The IDs of the sites to associate with this company.\nOn create: links all provided sites to the new company.\nOn update: replaces the full set of site associations (include in update_mask to apply)."
        },
        "linked_sites": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/$defs/s12.contractors.v1.ContractorCompanyLinkedSite"
          },
          "description": "The sites currently linked to this company, including resolved site names.\nPopulated on read responses only; to modify the site associations use site_ids.",
          "readOnly": true
        },
        "outstanding_document_request_count": {
          "type": "integer",
          "format": "int32",
          "description": "The number of document requests made to this company that are still outstanding.\nA request is outstanding when the company has not uploaded a document against it,\nor when the document they uploaded was rejected.\n\nPopulated on list responses only. Endpoints that return a single company leave it at 0,\nso do not read it from those; call the list endpoint if you need this count.",
          "readOnly": true
        }
      },
      "description": "Intrinsic attributes associated with a contractor company."
    },
    "s12.contractors.v1.ContractorCompanyLinkedSite": {
      "type": "object",
      "properties": {
        "site_id": {
          "type": "string",
          "description": "The ID of the linked site."
        },
        "site_name": {
          "type": "string",
          "description": "The display name of the linked site."
        }
      },
      "description": "A site linked to a contractor company, including its resolved name."
    },
    "s12.contractors.v1.ContractorCompanyStatus": {
      "type": "string",
      "enum": [
        "CONTRACTOR_COMPANY_STATUS_ACTIVE",
        "CONTRACTOR_COMPANY_STATUS_PENDING",
        "CONTRACTOR_COMPANY_STATUS_DEACTIVATED"
      ],
      "description": "The status of a contractor company.\n\n - CONTRACTOR_COMPANY_STATUS_ACTIVE: The company is active.\n - CONTRACTOR_COMPANY_STATUS_PENDING: The company is pending approval.\n - CONTRACTOR_COMPANY_STATUS_DEACTIVATED: The company is deactivated."
    }
  }
}