{
  "title": "Map Service Layer (ArcGISMapServiceLayer)",
  "type": "object",
  "$schema": "http://json-schema.org/draft-04/schema",
  "description": "Map services can be cached (tiled) or uncached (dynamic). This object specifically details properties within uncached map services.",
  "properties": {
    "id": {
      "type": "string",
      "description": "A unique identifying string for the layer."
    },
    "isReference": {
      "type": "boolean",
      "description": "This is applicable if used as a baseMapLayer. A boolean value indicating whether or not the baseMapLayer draws on top (true) of other layers, including operationalLayers, or below (false).",
      "default": false
    },
    "itemId": {
      "type": "string",
      "description": "Optional string containing the item ID of the service if it's registered on ArcGIS Online or your organization's portal."
    },
    "layerType": {
      "type": "string",
      "description": "String indicating the layer type.",
      "enum": [
        "ArcGISMapServiceLayer"
      ]
    },
    "layers": {
      "type": "array",
      "description": "An array of layer objects defining the styling, geometry, and attribute information for the features.",
      "items": {
        "allOf": [
          {
            "$ref": "layer_schema.json"
          },
          {
            "properties": {
              "defaultVisibility": {},
              "disablePopup": {},
              "id": {},
              "layerDefinition": {},
              "listMode": {},
              "maxScale": {},
              "minScale": {},
              "name": {},
              "parentLayerId": {},
              "popupInfo": {},
              "showLabels": {},
              "showLegend": {},
              "subLayerIds": {}
            },
            "additionalProperties": false
          }
        ]
      },
      "uniqueItems": true
    },
    "listMode": {
      "type": "string",
      "description": "To show or hide the sublayer in the layer list. If the layer has sublayers, selecting `hide-children` will hide them in the layer list.",
      "enum": [
        "hide",
        "hide-children",
        "show"
      ]
    },
    "maxScale": {
      "type": "number",
      "description": "A number representing the maximum scale at which the layer will be visible. The number is the scale's denominator.",
      "minimum": 0
    },
    "minScale": {
      "type": "number",
      "description": "A number representing the minimum scale at which the layer will be visible. The number is the scale's denominator.",
      "minimum": 0
    },
    "opacity": {
      "type": "number",
      "description": "The degree of transparency applied to the layer on the client side, where 0 is full transparency and 1 is no transparency.",
      "minimum": 0,
      "maximum": 1,
      "default": 1
    },
    "refreshInterval": {
      "type": "number",
      "description": "Refresh interval of the layer in minutes. Non-zero value indicates automatic layer refresh at the specified interval. Value of 0 indicates auto refresh is not enabled."
    },
    "showLegend": {
      "type": "boolean",
      "description": "Boolean value indicating whether to display the layer in the legend. Default value is `true`.",
      "default": true
    },
    "title": {
      "type": "string",
      "description": "A user-friendly string title for the layer that can be used in a table of contents."
    },
    "url": {
      "type": "string",
      "description": "The URL to the layer.",
      "format": "uri"
    },
    "visibility": {
      "type": "boolean",
      "description": "Boolean property determining whether the layer is initially visible in the web scene.",
      "default": true
    },
    "visibleLayers": {
      "type": "array",
      "description": "An array of sublayer ids that should appear visible. Used with map service layers that are not tiled.",
      "items": {
        "type": "integer"
      },
      "uniqueItems": true
    }
  },
  "required": [
    "id",
    "layerType",
    "title",
    "url"
  ],
  "additionalProperties": false,
  "esriDocumentation": {
    "examples": [
      {
        "title": "operationalLayer",
        "description": "Live sample web scene showing the ArcGISMapServiceLayer as an [operationalLayer](https://www.arcgis.com/home/webscene/viewer.html?webscene=3c04b5e8c19c42e490b0823d05cf7a9d)",
        "code": {
          "operationalLayers": [
            {
              "id": "15988a24a0e-layer-2",
              "layerType": "ArcGISMapServiceLayer",
              "url": "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer",
              "visibility": true,
              "opacity": 1,
              "title": "Census"
            }
          ]
        }
      },
      {
        "title": "baseMapLayer",
        "description": "",
        "code": {
          "baseMapLayers": [
            {
              "id": "defaultBasemap",
              "layerType": "ArcGISMapServiceLayer",
              "url": "https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer",
              "visibility": true,
              "opacity": 1,
              "title": "Topographic"
            },
            {
              "id": "Census_6367",
              "layerType": "ArcGISMapServiceLayer",
              "url": "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer",
              "visibility": true,
              "opacity": 1,
              "title": "Census",
              "showLegend": true
            }
          ],
          "title": "Topographic"
        }
      }
    ]
  }
}
