'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.filters = exports.fieldAnalysis = exports.features = exports.feature = exports.mapboxFilter = exports.fieldMapping = exports.paperSize = exports.settings = exports.colorIndex = exports.mapViewFeature = undefined;

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _constants = require('../constants');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// GeoJSON passed to the map view must be a FeatureCollection
// of point features.
// We need to ensure each feature has an id so we can handle
// callbacks for when a marker is clicked or hovered.
var mapViewFeature = exports.mapViewFeature = _propTypes2.default.shape({
  id: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]).isRequired,
  type: _propTypes2.default.oneOf(['Feature']),
  geometry: _propTypes2.default.oneOfType([_propTypes2.default.oneOf([null]), _propTypes2.default.shape({
    type: _propTypes2.default.oneOf(['Point']).isRequired,
    coordinates: _propTypes2.default.array.isRequired
  })])
});

var colorIndex = exports.colorIndex = _propTypes2.default.objectOf(_propTypes2.default.string);

var settings = exports.settings = _propTypes2.default.shape({
  coordFormat: _propTypes2.default.oneOf([_constants.FORMATS_UTM, _constants.FORMATS_DEC_DEG, _constants.FORMATS_DEG_MIN_SEC])
});

var paperSize = exports.paperSize = _propTypes2.default.oneOf(['a4', 'letter']);

var fieldMapping = exports.fieldMapping = _propTypes2.default.shape({
  media: _propTypes2.default.string,
  mediaType: _propTypes2.default.string,
  title: _propTypes2.default.string.isRequired,
  subtitle: _propTypes2.default.string
});

/* See https://www.mapbox.com/mapbox-gl-style-spec/#types-filter */
/* We only support a specific subset of the mapbox array spec */
var mapboxFilter = exports.mapboxFilter = _propTypes2.default.arrayOf(_propTypes2.default.oneOfType([_propTypes2.default.oneOf(['all']), _propTypes2.default.arrayOf(_propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number, _propTypes2.default.array, _propTypes2.default.bool]))]));

var feature = exports.feature = _propTypes2.default.shape({
  type: _propTypes2.default.oneOf(['Feature']).isRequired,
  geometry: _propTypes2.default.oneOfType([_propTypes2.default.oneOf([null]), _propTypes2.default.shape({
    type: _propTypes2.default.oneOf(['Point']).isRequired,
    coordinates: _propTypes2.default.array.isRequired
  })]),
  properties: _propTypes2.default.object
});

var features = exports.features = _propTypes2.default.arrayOf(feature);

var fieldAnalysisField = _propTypes2.default.shape({
  fieldname: _propTypes2.default.string,
  count: _propTypes2.default.number,
  filterType: _propTypes2.default.string,
  isUnique: _propTypes2.default.bool,
  type: _propTypes2.default.string
});

var fieldAnalysis = exports.fieldAnalysis = _propTypes2.default.shape({
  $id: fieldAnalysisField,
  $type: fieldAnalysisField,
  properties: _propTypes2.default.objectOf(fieldAnalysisField).isRequired
});

/**
 * Our filter structure is similar to mapbox filters but we index
 * by key and then expression. We only allow filters to combined
 * with logical AND using the "all" expression.
 * @example
 * ```
 * var filter = {
 *   name: {
 *     'in': ['bob', 'susan']
 *   },
 *   age: {
 *     '<=': 50,
 *     '>=': 30
 *   }
 * }
 */
var filters = exports.filters = _propTypes2.default.objectOf(_propTypes2.default.objectOf(_propTypes2.default.arrayOf(_propTypes2.default.string)));
//# sourceMappingURL=prop_types.js.map