/**
* BeNomad BeMap JavaScript API - NearPoiRequest
*
* Typed request for `bemap.NearPoiSearch.nearPoi(request)`. Returns POIs
* reachable from a coordinate within a distance budget.
*
* Wire shape mirrors the BeMap server contract (cross-checked against
* `bemap-flutter-api/lib/service/near_poi/model/near_poi_request.dart`).
* Endpoint: `POST service/nearpoi/1.0`.
*
* Required wire fields: `coordinate`, `distance`, `transportType`.
*
* @since 1.5.0
* @public
* @constructor
* @param {Object} [options]
* @param {bemap.CoordinateSat|bemap.Coordinate|Object} [options.coordinate] Centre of the search.
* @param {Number} [options.distance=500] Limit of research in metres.
* @param {String} [options.transportType] One of `bemap.TransportMode.*`. Defaults to CAR.
* @param {String} [options.orderBy] One of `bemap.NearPoiOrder.*`. Optional.
* @param {Boolean} [options.enablePolyline] Include the route polyline per POI.
* @param {Boolean} [options.enableEncodedPolyline] Same, Google-encoded.
* @param {String} [options.geoserver]
* @param {Number} [options.switchIndex]
*/
bemap.NearPoiRequest = function(options) {
var opts = options || {};
this.coordinate = bemap.RoutingDestination._coerceCoordinateSat(opts.coordinate);
this.distance = (typeof opts.distance === 'number') ? opts.distance : 500;
this.transportType = opts.transportType || bemap.TransportMode.CAR;
this.orderBy = opts.orderBy || null;
this.enablePolyline = (typeof opts.enablePolyline === 'boolean') ? opts.enablePolyline : null;
this.enableEncodedPolyline = (typeof opts.enableEncodedPolyline === 'boolean') ? opts.enableEncodedPolyline : null;
this.geoserver = opts.geoserver || null;
this.switchIndex = (typeof opts.switchIndex === 'number') ? opts.switchIndex : null;
};
bemap.NearPoiRequest.prototype.setCoordinate = function(v) {
this.coordinate = bemap.RoutingDestination._coerceCoordinateSat(v);
return this;
};
bemap.NearPoiRequest.prototype.setDistance = function(v) { this.distance = v; return this; };
bemap.NearPoiRequest.prototype.setTransportType = function(v) { this.transportType = v; return this; };
bemap.NearPoiRequest.prototype.setOrderBy = function(v) { this.orderBy = v; return this; };
bemap.NearPoiRequest.prototype.setEnablePolyline = function(v) { this.enablePolyline = !!v; return this; };
bemap.NearPoiRequest.prototype.setEnableEncodedPolyline = function(v) { this.enableEncodedPolyline = !!v; return this; };
bemap.NearPoiRequest.prototype.setGeoserver = function(g) { this.geoserver = g; return this; };
bemap.NearPoiRequest.prototype.toJson = function() {
var body = {};
if (this.coordinate) body.coordinate = this.coordinate.toJson();
body.distance = this.distance;
body.transportType = this.transportType;
if (this.orderBy) body.orderBy = this.orderBy;
if (this.enablePolyline !== null) body.enablePolyline = this.enablePolyline;
if (this.enableEncodedPolyline !== null) body.enableEncodedPolyline = this.enableEncodedPolyline;
if (this.geoserver) body.geoserver = this.geoserver;
if (this.switchIndex !== null) body.switchIndex = this.switchIndex;
return body;
};