{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/Integration",
  "title": "Integration",
  "description": "An integration that Codat supports",
  "examples": [
    {
      "key": "gbol",
      "logoUrl": "http://example.com",
      "name": "Xero",
      "enabled": true,
      "sourceId": "accounting",
      "sourceType": "8193a927-ab7a-45a3-9dc2-d357a4932dfe",
      "integrationId": "497a18ca-284e-40c0-985d-f72be35d468e",
      "isOfflineConnector": true,
      "isBeta": true,
      "dataProvidedBy": "string",
      "datatypeFeatures": [
        {
          "datatype": "invoices",
          "supportedFeatures": [
            {
              "featureType": "get",
              "featureState": "release"
            }
          ]
        }
      ]
    }
  ],
  "type": "object",
  "properties": {
    "key": {
      "$ref": "#/components/parameters/platformKey/schema"
    },
    "logoUrl": {
      "type": "string",
      "format": "uri",
      "description": "Static url for integration's logo."
    },
    "name": {
      "type": "string",
      "example": "Xero",
      "description": "Name of integration."
    },
    "enabled": {
      "type": "boolean",
      "description": "Whether this integration is enabled for your customers to use."
    },
    "sourceId": {
      "$ref": "#/components/schemas/Branding/properties/sourceId"
    },
    "sourceType": {
      "$ref": "#/components/schemas/Integration/definitions/sourceType"
    },
    "integrationId": {
      "$ref": "#/components/schemas/Connection/properties/integrationId"
    },
    "isOfflineConnector": {
      "type": "boolean",
      "description": "`True` if the integration is to an application installed and run locally on an SMBs computer."
    },
    "isBeta": {
      "type": "boolean",
      "description": "`True` if the integration is currently in beta release."
    },
    "dataProvidedBy": {
      "type": "string",
      "description": "The name of the data provider."
    },
    "datatypeFeatures": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Integration/definitions/dataTypeFeature"
      }
    }
  },
  "required": [
    "key",
    "logoUrl",
    "name",
    "enabled"
  ],
  "definitions": {
    "sourceType": {
      "title": "Source Type",
      "description": "The type of platform of the connection.",
      "type": "string",
      "enum": [
        "Accounting",
        "Banking",
        "BankFeed",
        "Commerce",
        "Expense",
        "Other",
        "Unknown"
      ],
      "example": "Accounting"
    },
    "dataTypeFeature": {
      "title": "Data type feature",
      "description": "Describes support for a given datatype and associated operations",
      "type": "object",
      "properties": {
        "dataType": {
          "$ref": "#/components/schemas/DataStatus/properties/dataType"
        },
        "supportedFeatures": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/Integration/definitions/supportedFeature"
          }
        }
      },
      "required": [
        "datatype",
        "supportedFeatures"
      ],
      "examples": [
        {
          "datatype": "invoices",
          "supportedFeatures": [
            {
              "featureType": "Get",
              "featureState": "Release"
            }
          ]
        }
      ]
    },
    "supportedFeature": {
      "type": "object",
      "x-internal": true,
      "properties": {
        "featureType": {
          "$ref": "#/components/schemas/Integration/definitions/featureType"
        },
        "featureState": {
          "$ref": "#/components/schemas/Integration/definitions/featureState"
        }
      },
      "required": [
        "featureType",
        "featureState"
      ]
    },
    "featureState": {
      "title": "Feature state",
      "type": "string",
      "example": "Release",
      "description": "The current release state of the feature.",
      "enum": [
        "Release",
        "Alpha",
        "Beta",
        "Deprecated",
        "NotSupported",
        "NotImplemented"
      ]
    },
    "featureType": {
      "type": "string",
      "x-internal": true,
      "description": "The type of feature.",
      "enum": [
        "Get",
        "Post",
        "Categorization",
        "Delete",
        "Put",
        "GetAsPdf",
        "DownloadAttachment",
        "GetAttachment",
        "GetAttachments",
        "UploadAttachment"
      ],
      "example": "Get"
    }
  }
}