/**
* BeNomad BeMap JavaScript API - AclLabel
*
* One entry in `AclDetailsResponse.geoservers[]` or
* `AclDetailsResponse.chargingStationProviders[]`. Mirrors the server-side
* `Label` DTO (in `bemap_idea/.../service/v1_0_0/model/acl/Label.java`):
*
* { key: string, value: string, byDefault: boolean? }
*
* - `key` — machine identifier passed back to the server (e.g. `'osm'`, `'here'`, `'ecoMovement'`)
* - `value` — human-readable display title (e.g. `'OpenStreetMap'`, `'HERE'`, `'Eco-Movement'`)
* - `byDefault` — optional flag marking the user's default for this category. Absent / `false` means "not default".
*
* @since 1.5.0
* @public
* @constructor
*/
bemap.AclLabel = function(options) {
var opts = options || {};
this.key = opts.key || null;
this.value = opts.value || null;
this.byDefault = (opts.byDefault === true);
};
bemap.AclLabel.prototype.getKey = function() { return this.key; };
bemap.AclLabel.prototype.getValue = function() { return this.value; };
bemap.AclLabel.prototype.isDefault = function() { return this.byDefault; };
/** @public — display string ("Title (key)" when both exist, else whichever is available). */
bemap.AclLabel.prototype.getDisplayString = function() {
if (this.value && this.key && this.value !== this.key) {
return this.value + ' (' + this.key + ')';
}
return this.value || this.key || '';
};
bemap.AclLabel.fromJson = function(raw) {
if (!raw) return new bemap.AclLabel();
return new bemap.AclLabel({
key: raw.key,
value: raw.value,
byDefault: raw.byDefault === true
});
};