let defaultMapboxToken = "pk.eyJ1IjoidXNhY2UiLCJhIjoiY2p4YW5hdjR6MThoZDNubG1mdG1rYXR1dSJ9.1jDEJhe6OP-e6iZNeEtzjA";
// Set value REACT_APP_MAPBOX_TOKEN in application. For instance, Corpsmap-orm, FUDSMIS
// For localhost create .env.development REACT_APP_MAPBOX_TOKEN="mapboxToken"
// use token if it is undefined
let mapboxTokenEnvVariable = `${process.env.REACT_APP_MAPBOX_TOKEN}`;
let mapboxToken = mapboxTokenEnvVariable === "undefined"  ? defaultMapboxToken : mapboxTokenEnvVariable ;

const config = {
  map: {
    basemap: 0,
    centerX: -98.579,
    centerY: 39.828,
    centerZ: 7,
    altitude3d: 14771168,
    heading3d: 0,
    tilt3d: 0,
    minzoom: 0,
    maxzoom: 22,
    rotation: 0,
  },
  dim: "2d",
  theme: "bg-blue-chambray",
  mapboxToken: mapboxToken ,
  basemaps: [
    {
      id: "OpenStreetMap",
      name: "OpenStreetMap",
      url: "https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png",
      maxZoom: 19,
      attributions:
        '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
      visible: true
    },
    {
      id: "MapBoxStreets",
      name: "MapBox Streets",
      url:
        "https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/256/{z}/{x}/{y}?access_token={accessToken}",
      attributions:
        'Imagery from <a href="https://mapbox.com/about/maps/">MapBox</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
      subdomains: "abcd",
      accessToken: mapboxToken,
      visible: false
    },
    {
      id: "MapBoxAerial",
      name: "MapBox Aerial",
      url:
        "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/256/{z}/{x}/{y}?access_token={accessToken}",
      attributions:
        'Imagery from <a href="https://mapbox.com/about/maps/">MapBox</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
      subdomains: "abcd",
      accessToken: mapboxToken,
      visible: false
    },
    {
      id: "MapBoxOutdoor",
      name: "MapBox Outdoor",
      url:
        "https://api.mapbox.com/styles/v1/mapbox/outdoors-v10/tiles/256/{z}/{x}/{y}?access_token={accessToken}",
      attributions:
        'Imagery from <a href="https://mapbox.com/about/maps/">MapBox</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
      subdomains: "abcd",
      accessToken: mapboxToken,
      visible: false
    },
    // {
    //   id: "StamenToner",
    //   name: "Stamen Toner",
    //   url: "https://stamen-tiles-{a-d}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",
    //   attributions:
    //     'Map tiles by <a href="https://stamen.com">Stamen Design</a>, <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
    //   subdomains: "abcd",
    //   minZoom: 0,
    //   maxZoom: 20,
    //   ext: "png",
    //   visible: false
    // },
    // {
    //   id: "StamenWatercolor",
    //   name: "Stamen Watercolor",
    //   url:
    //     "https://stamen-tiles-{a-d}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg",
    //   attributions:
    //     'Map tiles by <a href="https://stamen.com">Stamen Design</a>, <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
    //   subdomains: "abcd",
    //   minZoom: 1,
    //   maxZoom: 16,
    //   ext: "png",
    //   visible: false
    // },
    {
      id: "EsriWorldStreetMap",
      name: "ESRI Streetmap",
      url:
        "https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",
      attributions:
        "Tiles &copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012",
      visible: false
    },
    {
      id: "EsriWorldImagery",
      name: "ESRI World Imagery",
      url:
        "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
      attributions:
        "Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community",
      visible: false
    },
    {
      id: "EsriUSATopoMaps",
      name: "ESRI Topo Maps",
      url:
        "https://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}",
      attributions:
        "Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community",
      visible: false
    },
    {
      id: "EsriWorldShadedRelief",
      name: "ESRI World Hillshade",
      url:
        "https://services.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}",
      attributions:
        "Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community",
      visible: false
    },
    {
      id: "EsriWorldOcean",
      name: "ESRI World Ocean",
      url:
        "https://services.arcgisonline.com/ArcGIS/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}",
      attributions:
        "Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community",
      visible: false
    },
    {
      id: "USGSImageryTopo",
      name: "USGS Imagery/Topo",
      url:
        "https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryTopo/MapServer/tile/{z}/{y}/{x}",
      attributions:
        "Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community",
      visible: false
    },
    {
      id: "CartoDBDarkMatter",
      name: "CartoDB Dark Matter",
      url:
        "https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png",
      attributions:
        '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> &copy; <a href="https://cartodb.com/attributionss">CartoDB</a>',
      subdomains: "abcd",
      maxZoom: 19,
      visible: false
    },
    {
      id: "CartoDBPositron",
      name: "CartoDB Positron",
      url:
        "https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
      attributions:
        '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> &copy; <a href="https://cartodb.com/attributionss">CartoDB</a>',
      subdomains: "abcd",
      maxZoom: 19,
      visible: false
    }
  ],
  datasetsDontUse: [
    {
      id: null,
      parentId: null,
      layerOrder: 1,
      mapId: 646,
      mapUuid: null,
      teamId: null,
      datasetId: null,
      teamDatasetId: null,
      serviceType: "EsriFeatureService",
      tiled: 0,
      displayName: "Foundational Project Area",
      description: "",
      url:
        "https://services7.arcgis.com/n1YM8pTrFmm7L4hs/ArcGIS/rest/services/corps_projects/FeatureServer",
      grids: null,
      layerList: "1",
      attribution: null,
      geometryType: "POINT",
      minzoom: 1,
      maxzoom: 22,
      abstract: null,
      purpose: null,
      status: null,
      keywords: null,
      localTable: null,
      metadataUrl: null,
      minX: -177.47,
      maxX: -64.71000000000001,
      minY: 13.43,
      maxY: 72.55,
      opacity: 1,
      useMapfile: 1,
      queryTemplate: "",
      hoverTemplate: "",
      queryable: 1,
      visible: 0,
      collapsed: 1,
      idCol: "objectid",
      shapeCol: "SHAPE",
      allowEdit: 0,
      allowExport: 1,
      createdBy: "1380992694",
      createDate: "2017-12-12T13:15:12.000Z",
      cacheTiles: 0,
      labelDefault: 0,
      labelEnabled: 0,
      deep: 2,
      path: "depricated",
      styleFn: `(
      function(f){
        const div = f.get('DIV_SYM');
        const colors = {
          'MVD':'#949CA3',
          'NAD':'#334762',
          'NWD':'#B39A67',
          'POD':'#D8AE46',
          'SAD':'#B24C2E',
          'SPD':'#B15142',
          'SWD':'#BB742B',
          'LRD':'#257F6A'
        }
        const style = new window.olStyle.Style({
          fill: new window.olStyle.Fill({
            color: colors[div]
          }),
          stroke: new window.olStyle.Stroke({
            color: '#362A2C',
            width: 0.4
          })
        })
        return style;
      }
    )`
    },
    {
      id: null,
      parentId: null,
      layerOrder: 1,
      mapId: 646,
      mapUuid: null,
      teamId: null,
      datasetId: null,
      teamDatasetId: null,
      serviceType: "EsriFeatureService",
      tiled: 0,
      displayName: "Divisions",
      description: "",
      url:
        "https://services7.arcgis.com/n1YM8pTrFmm7L4hs/ArcGIS/rest/services/usace_cw_divisions/FeatureServer",
      grids: null,
      layerList: "0",
      attribution: null,
      geometryType: "POINT",
      minzoom: 1,
      maxzoom: 22,
      abstract: null,
      purpose: null,
      status: null,
      keywords: null,
      localTable: null,
      metadataUrl: null,
      minX: -177.47,
      maxX: -64.71000000000001,
      minY: 13.43,
      maxY: 72.55,
      opacity: 1,
      useMapfile: 1,
      queryTemplate: "",
      hoverTemplate: "",
      queryable: 1,
      visible: 0,
      collapsed: 1,
      idCol: "objectid",
      shapeCol: "SHAPE",
      allowEdit: 0,
      allowExport: 1,
      createdBy: "1380992694",
      createDate: "2017-12-12T13:15:12.000Z",
      cacheTiles: 0,
      labelDefault: 0,
      labelEnabled: 0,
      deep: 2,
      path: "depricated",
      styleFn: `(
      function(f){
        const div = f.get('DIV_SYM');
        const colors = {
          'MVD':'#949CA3',
          'NAD':'#334762',
          'NWD':'#B39A67',
          'POD':'#D8AE46',
          'SAD':'#B24C2E',
          'SPD':'#B15142',
          'SWD':'#BB742B',
          'LRD':'#257F6A'
        }
        const style = new window.olStyle.Style({
          fill: new window.olStyle.Fill({
            color: colors[div]
          }),
          stroke: new window.olStyle.Stroke({
            color: '#362A2C',
            width: 0.4
          })
        })
        return style;
      }
    )`
    },
    {
      id: null,
      parentId: null,
      layerOrder: 1,
      mapId: 646,
      mapUuid: null,
      teamId: null,
      datasetId: null,
      teamDatasetId: null,
      serviceType: "RemoteVector",
      tiled: 0,
      displayName: "Dam Status",
      description: "",
      url:
        "https://3s4qp7rua9.execute-api.us-east-1.amazonaws.com/production/dams",
      grids: null,
      layerList: "ahpsfcst_minor",
      attribution: null,
      geometryType: "POINT",
      minzoom: 1,
      maxzoom: 22,
      abstract: null,
      purpose: null,
      status: null,
      keywords: null,
      localTable: null,
      metadataUrl: null,
      minX: -177.47,
      maxX: -64.71000000000001,
      minY: 13.43,
      maxY: 72.55,
      opacity: 1,
      useMapfile: 1,
      queryTemplate: "",
      hoverTemplate: "",
      queryable: 1,
      visible: 0,
      collapsed: 1,
      idCol: "objectid",
      shapeCol: "SHAPE",
      allowEdit: 0,
      allowExport: 1,
      createdBy: "1380992694",
      createDate: "2017-12-12T13:15:12.000Z",
      cacheTiles: 0,
      labelDefault: 0,
      labelEnabled: 0,
      deep: 2,
      path: "depricated",
      styleFn: `(
        function(f){
          const b = f.get('briefit');
          const t = f.get('systemname');
          const h = b === 'Y';
          const labelStyle = new window.olStyle.Style({
            text: new window.olStyle.Text({
              text: h ? t : null,
              font: 'bold 16px sans-serif',
              textAlign:'left',
              offsetX:3,
              offsetY:-3,
              textAlign: 'left',
              textBaseline: 'bottom',
              overflow: true,
              stroke: new window.olStyle.Stroke({
                color:'#ABB1A5',
                width: 2
              }),
              fill: new window.olStyle.Fill({
                color: '#0E0D1E'
              })
            })
          })
          const pointStyle = new window.olStyle.Style({
            allowOverlap: true,
            image: new window.olStyle.Circle({
              radius: h ? 9 : 6,
              stroke: new window.olStyle.Stroke({
                color: '#ABB1A5',
                width: 2
              }),
              fill: new window.olStyle.Fill({
                color: h ? '#773621' : '#C14F11'
              })
            })
          });
          return [pointStyle, labelStyle];
        }
      )`
    },
    {
      id: null,
      parentId: null,
      layerOrder: 1,
      mapId: 646,
      mapUuid: null,
      teamId: null,
      datasetId: null,
      teamDatasetId: null,
      serviceType: "RemoteVector",
      tiled: 0,
      displayName: "Levee Data",
      description: "Real time forecast values from NOAA. Updated hourly",
      url:
        "https://3s4qp7rua9.execute-api.us-east-1.amazonaws.com/production/levees",
      grids: null,
      layerList: "ahpsfcst_minor",
      attribution: null,
      geometryType: "POINT",
      minzoom: 1,
      maxzoom: 22,
      abstract: null,
      purpose: null,
      status: null,
      keywords: null,
      localTable: null,
      metadataUrl: null,
      minX: -177.47,
      maxX: -64.71000000000001,
      minY: 13.43,
      maxY: 72.55,
      opacity: 1,
      useMapfile: 1,
      queryTemplate: "",
      hoverTemplate: "",
      queryable: 1,
      visible: 0,
      collapsed: 1,
      idCol: "objectid",
      shapeCol: "SHAPE",
      allowEdit: 0,
      allowExport: 1,
      createdBy: "1380992694",
      createDate: "2017-12-12T13:15:12.000Z",
      cacheTiles: 0,
      labelDefault: 0,
      labelEnabled: 0,
      deep: 2,
      path: "depricated",
      styleFn: `(
        function(f){
          const b = f.get('briefit');
          const t = f.get('systemname');
          const h = b === 'Y';
          const labelStyle = new window.olStyle.Style({
            text: new window.olStyle.Text({
              text: h ? t : null,
              font: 'bold 16px sans-serif',
              textAlign:'left',
              offsetX:3,
              offsetY:-3,
              textAlign: 'left',
              textBaseline: 'bottom',
              overflow: true,
              stroke: new window.olStyle.Stroke({
                color:'#DAD9C4',
                width: 2
              }),
              fill: new window.olStyle.Fill({
                color: '#33302A'
              })
            })
          })
          const pointStyle = new window.olStyle.Style({
            allowOverlap: true,
            image: new window.olStyle.Circle({
              radius: h ? 9 : 6,
              stroke: new window.olStyle.Stroke({
                color: '#DAD9C4',
                width: 2
              }),
              fill: new window.olStyle.Fill({
                color: h ? '#B85B2B' : '#DEA500'
              })
            })
          });
          return [pointStyle, labelStyle];
        }
      )`
    },
    {
      id: 13597,
      parentId: null,
      layerOrder: 2,
      mapId: 646,
      mapUuid: null,
      teamId: 39,
      datasetId: 716,
      teamDatasetId: 713,
      serviceType: "XYZ",
      tiled: 1,
      displayName: "Minor Flooding",
      description: "Real time forecast values from NOAA. Updated hourly",
      url:
        "https://rsgis-testdev.crrel.usace.army.mil/tiles/mstile/m.e847f06e3f0982927900594d68264d61/geom/{z}/{x}/{y}.png?nocache=true",
      grids: null,
      layerList: "ahpsfcst_minor",
      attribution: null,
      geometryType: "POINT",
      minzoom: 1,
      maxzoom: 22,
      abstract: null,
      purpose: null,
      status: null,
      keywords: null,
      localTable: "NOAA.NATIONAL_FCST_VW_MIN",
      metadataUrl: null,
      minX: -177.47,
      maxX: -64.71000000000001,
      minY: 13.43,
      maxY: 72.55,
      opacity: 1,
      useMapfile: 1,
      queryTemplate:
        'Location "Location", waterbody "Waterbody", state "State", to_char(fcstdate,\'mm/dd/yyyy hh:mi: am\') "Forecast Time", forecast||\' \'||units "Forecast", \'<a  href="\'||url||\'" target="_blank"><img src="http://water.weather.gov/resources/hydrographs/\'||lower(gaugelid)||\'_hg.png" width="300px"/></a>\' "Hyperlink", action "Action Level", flood "Flood Level" , moderate "Mod Flood Level", major "Major Flood Level"',
      hoverTemplate:
        'Location "Location", waterbody "Waterbody", state "State", to_char(fcstdate,\'mm/dd/yyyy hh:mi: am\') "Forecast Time", forecast||\' \'||units "Forecast", \'<a  href="\'||url||\'" target="_blank"><img src="http://water.weather.gov/resources/hydrographs/\'||lower(gaugelid)||\'_hg.png" width="300px"/></a>\' "Hyperlink", action "Action Level", flood "Flood Level" , moderate "Mod Flood Level", major "Major Flood Level"',
      queryable: 1,
      visible: 0,
      collapsed: 1,
      idCol: "objectid",
      shapeCol: "SHAPE",
      allowEdit: 0,
      allowExport: 1,
      createdBy: "1380992694",
      createDate: "2017-12-12T13:15:12.000Z",
      cacheTiles: 0,
      labelDefault: 0,
      labelEnabled: 0,
      deep: 2,
      path: "depricated"
    }
  ]
};

export default config;
