/**
* BeNomad BeMap JavaScript API - ChargingStationPool (v1.5)
*
* One charging-station pool returned by `service/chargingstation/search/1.0`.
*
* Wire shape mirrors the server DTO in
* `bemap_idea/.../service/v1_0_0/model/chargingStation/ChargingStationPool.java`.
*
* @public
* @constructor
* @param {Object} options Parsed JSON entry from the server response.
*/
bemap.ChargingStationPool = function(options) {
var opts = options || {};
this.providerName = opts.providerName || null;
this.providerMode = opts.providerMode || null;
this.id = opts.id || null;
this.operatorId = opts.operatorId || null;
this.sourceProvider = opts.sourceProvider || null;
this.customerId = opts.customerId || null;
this.updateDate = (typeof opts.updateDate === 'number') ? opts.updateDate : null;
this.tags = Array.isArray(opts.tags) ? opts.tags.slice() : null;
this.brand = opts.brand || null;
this.nameOfPool = opts.nameOfPool || null;
this.accessibility = opts.accessibility || null;
this.availabilityStatus = opts.availabilityStatus || null;
this.longitude = (typeof opts.longitude === 'number') ? opts.longitude : null;
this.latitude = (typeof opts.latitude === 'number') ? opts.latitude : null;
this.countryCode = opts.countryCode || null;
this.country = opts.country || null;
this.postalCode = opts.postalCode || null;
this.city = opts.city || null;
this.street = opts.street || null;
this.streetNumber = opts.streetNumber || null;
this.addressComplement = opts.addressComplement || null;
this.floorNumber = opts.floorNumber || null;
this.siteType = opts.siteType || null;
this.siteCategory = opts.siteCategory || null;
this.phoneNumber = opts.phoneNumber || null;
this.open24x7 = (typeof opts.open24x7 === 'boolean') ? opts.open24x7 : null;
this.openingHours = Array.isArray(opts.openingHours) ? opts.openingHours.slice() : null;
this.numberOfParkingSpace = (typeof opts.numberOfParkingSpace === 'number') ? opts.numberOfParkingSpace : null;
this.comment = opts.comment || null;
this.images = Array.isArray(opts.images) ? opts.images.slice() : null;
this.summaryOfConnectorTypeIds = Array.isArray(opts.summaryOfConnectorTypeIds) ? opts.summaryOfConnectorTypeIds.slice() : null;
this.maxNominalPower = (typeof opts.maxNominalPower === 'number') ? opts.maxNominalPower : null;
this.numberOfChargingPoint = (typeof opts.numberOfChargingPoint === 'number') ? opts.numberOfChargingPoint : null;
this.reliabilityScore = (typeof opts.reliabilityScore === 'number') ? opts.reliabilityScore : null;
this.predictedOccupancyTimeSlots = Array.isArray(opts.predictedOccupancyTimeSlots) ? opts.predictedOccupancyTimeSlots.slice() : null;
this.vehicleAccess = opts.vehicleAccess || null;
this.chargingStations = Array.isArray(opts.chargingStations)
? opts.chargingStations.map(function(s) { return new bemap.ChargingStation(s); })
: [];
};
bemap.ChargingStationPool.prototype.getId = function() { return this.id; };
bemap.ChargingStationPool.prototype.getProviderName = function() { return this.providerName; };
bemap.ChargingStationPool.prototype.getProviderMode = function() { return this.providerMode; };
bemap.ChargingStationPool.prototype.getOperatorId = function() { return this.operatorId; };
bemap.ChargingStationPool.prototype.getSourceProvider = function() { return this.sourceProvider; };
bemap.ChargingStationPool.prototype.getBrand = function() { return this.brand; };
bemap.ChargingStationPool.prototype.getName = function() { return this.nameOfPool; };
bemap.ChargingStationPool.prototype.getAccessibility = function() { return this.accessibility; };
bemap.ChargingStationPool.prototype.getAvailabilityStatus = function() { return this.availabilityStatus; };
/**
* Pool entrance coordinate as a `bemap.Coordinate`, or `null` when the
* server did not provide one.
* @public
* @return {bemap.Coordinate|null}
*/
bemap.ChargingStationPool.prototype.getCoordinate = function() {
if (this.longitude === null || this.latitude === null) return null;
return new bemap.Coordinate(this.longitude, this.latitude);
};
bemap.ChargingStationPool.prototype.getCountry = function() { return this.country; };
bemap.ChargingStationPool.prototype.getCountryCode = function() { return this.countryCode; };
bemap.ChargingStationPool.prototype.getCity = function() { return this.city; };
bemap.ChargingStationPool.prototype.getStreet = function() { return this.street; };
bemap.ChargingStationPool.prototype.getStreetNumber = function() { return this.streetNumber; };
bemap.ChargingStationPool.prototype.getPostalCode = function() { return this.postalCode; };
bemap.ChargingStationPool.prototype.getPhoneNumber = function() { return this.phoneNumber; };
bemap.ChargingStationPool.prototype.isOpen24x7 = function() { return this.open24x7; };
bemap.ChargingStationPool.prototype.getOpeningHours = function() { return this.openingHours; };
bemap.ChargingStationPool.prototype.getMaxNominalPower = function() { return this.maxNominalPower; };
bemap.ChargingStationPool.prototype.getNumberOfChargingPoint = function() { return this.numberOfChargingPoint; };
bemap.ChargingStationPool.prototype.getNumberOfParkingSpace = function() { return this.numberOfParkingSpace; };
bemap.ChargingStationPool.prototype.getReliabilityScore = function() { return this.reliabilityScore; };
bemap.ChargingStationPool.prototype.getSummaryOfConnectorTypeIds = function() { return this.summaryOfConnectorTypeIds; };
bemap.ChargingStationPool.prototype.getChargingStations = function() { return this.chargingStations; };
bemap.ChargingStationPool.prototype.getTags = function() { return this.tags; };
bemap.ChargingStationPool.prototype.getImages = function() { return this.images; };
bemap.ChargingStationPool.prototype.getUpdateDate = function() { return this.updateDate; };
/**
* Single-line, human-readable address for use in UI labels.
* @public
* @return {String|null}
*/
bemap.ChargingStationPool.prototype.getFormattedAddress = function() {
var bits = [];
if (this.streetNumber) bits.push(this.streetNumber);
if (this.street) bits.push(this.street);
var head = bits.join(' ');
var tail = [];
if (this.postalCode) tail.push(this.postalCode);
if (this.city) tail.push(this.city);
var line = [head, tail.join(' ')].filter(function(s) { return !!s; }).join(', ');
return line || null;
};