"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Config = exports.ClientConfig = exports.OtherCommunityInfoConfig = exports.CoordsSelectorConfig = exports.Coords = exports.MonitoringConfig = exports.ClientMapConfig = exports.LegalConfig = exports.CommunityConfig = exports.ServerConfig = exports.ServerMapConfig = exports.EmailConfig = exports.InternalConfig = exports.LoggingConfig = void 0;
const sparkson_1 = require("sparkson");
// TODO: Replace string types by more specific types like URL, Password, etc.
let LoggingConfig = class LoggingConfig {
    constructor(directory, debug, profile, logRequests) {
        this.directory = directory;
        this.debug = debug;
        this.profile = profile;
        this.logRequests = logRequests;
    }
};
LoggingConfig = __decorate([
    __param(0, sparkson_1.Field("directory")),
    __param(1, sparkson_1.Field("debug")),
    __param(2, sparkson_1.Field("profile")),
    __param(3, sparkson_1.Field("logRequests")),
    __metadata("design:paramtypes", [String, Boolean, Boolean, Boolean])
], LoggingConfig);
exports.LoggingConfig = LoggingConfig;
let InternalConfig = class InternalConfig {
    constructor(active, user, password) {
        this.active = active;
        this.user = user;
        this.password = password;
    }
};
InternalConfig = __decorate([
    __param(0, sparkson_1.Field("active")),
    __param(1, sparkson_1.Field("user")),
    __param(2, sparkson_1.Field("password")),
    __metadata("design:paramtypes", [Boolean, String, String])
], InternalConfig);
exports.InternalConfig = InternalConfig;
let EmailConfig = class EmailConfig {
    constructor(from, 
    // For details see: https://nodemailer.com/2-0-0-beta/setup-smtp/
    smtp) {
        this.from = from;
        this.smtp = smtp;
    }
};
EmailConfig = __decorate([
    __param(0, sparkson_1.Field("from")),
    __param(1, sparkson_1.RawJsonField("smtp")),
    __metadata("design:paramtypes", [String, Object])
], EmailConfig);
exports.EmailConfig = EmailConfig;
let ServerMapConfig = class ServerMapConfig {
    constructor(nodesJsonUrl) {
        this.nodesJsonUrl = nodesJsonUrl;
    }
};
ServerMapConfig = __decorate([
    __param(0, sparkson_1.ArrayField("nodesJsonUrl", String)),
    __metadata("design:paramtypes", [Array])
], ServerMapConfig);
exports.ServerMapConfig = ServerMapConfig;
let ServerConfig = class ServerConfig {
    constructor(baseUrl, port, databaseFile, peersPath, logging, internal, email, map, rootPath) {
        this.baseUrl = baseUrl;
        this.port = port;
        this.databaseFile = databaseFile;
        this.peersPath = peersPath;
        this.logging = logging;
        this.internal = internal;
        this.email = email;
        this.map = map;
        this.rootPath = rootPath;
    }
};
ServerConfig = __decorate([
    __param(0, sparkson_1.Field("baseUrl")),
    __param(1, sparkson_1.Field("port")),
    __param(2, sparkson_1.Field("databaseFile")),
    __param(3, sparkson_1.Field("peersPath")),
    __param(4, sparkson_1.Field("logging")),
    __param(5, sparkson_1.Field("internal")),
    __param(6, sparkson_1.Field("email")),
    __param(7, sparkson_1.Field("map")),
    __param(8, sparkson_1.Field("rootPath", true, undefined, "/")),
    __metadata("design:paramtypes", [String, Number, String, String, LoggingConfig,
        InternalConfig,
        EmailConfig,
        ServerMapConfig, String])
], ServerConfig);
exports.ServerConfig = ServerConfig;
let CommunityConfig = class CommunityConfig {
    constructor(name, domain, contactEmail, sites, domains) {
        this.name = name;
        this.domain = domain;
        this.contactEmail = contactEmail;
        this.sites = sites;
        this.domains = domains;
    }
};
CommunityConfig = __decorate([
    __param(0, sparkson_1.Field("name")),
    __param(1, sparkson_1.Field("domain")),
    __param(2, sparkson_1.Field("contactEmail")),
    __param(3, sparkson_1.ArrayField("sites", String)),
    __param(4, sparkson_1.ArrayField("domains", String)),
    __metadata("design:paramtypes", [String, String, String, Array, Array])
], CommunityConfig);
exports.CommunityConfig = CommunityConfig;
let LegalConfig = class LegalConfig {
    constructor(privacyUrl, imprintUrl) {
        this.privacyUrl = privacyUrl;
        this.imprintUrl = imprintUrl;
    }
};
LegalConfig = __decorate([
    __param(0, sparkson_1.Field("privacyUrl", true)),
    __param(1, sparkson_1.Field("imprintUrl", true)),
    __metadata("design:paramtypes", [String, String])
], LegalConfig);
exports.LegalConfig = LegalConfig;
let ClientMapConfig = class ClientMapConfig {
    constructor(mapUrl) {
        this.mapUrl = mapUrl;
    }
};
ClientMapConfig = __decorate([
    __param(0, sparkson_1.Field("mapUrl")),
    __metadata("design:paramtypes", [String])
], ClientMapConfig);
exports.ClientMapConfig = ClientMapConfig;
let MonitoringConfig = class MonitoringConfig {
    constructor(enabled) {
        this.enabled = enabled;
    }
};
MonitoringConfig = __decorate([
    __param(0, sparkson_1.Field("enabled")),
    __metadata("design:paramtypes", [Boolean])
], MonitoringConfig);
exports.MonitoringConfig = MonitoringConfig;
let Coords = class Coords {
    constructor(lat, lng) {
        this.lat = lat;
        this.lng = lng;
    }
};
Coords = __decorate([
    __param(0, sparkson_1.Field("lat")),
    __param(1, sparkson_1.Field("lng")),
    __metadata("design:paramtypes", [Number, Number])
], Coords);
exports.Coords = Coords;
let CoordsSelectorConfig = class CoordsSelectorConfig {
    constructor(lat, lng, defaultZoom, layers) {
        this.lat = lat;
        this.lng = lng;
        this.defaultZoom = defaultZoom;
        this.layers = layers;
    }
};
CoordsSelectorConfig = __decorate([
    __param(0, sparkson_1.Field("lat")),
    __param(1, sparkson_1.Field("lng")),
    __param(2, sparkson_1.Field("defaultZoom")),
    __param(3, sparkson_1.RawJsonField("layers")),
    __metadata("design:paramtypes", [Number, Number, Number, Object])
], CoordsSelectorConfig);
exports.CoordsSelectorConfig = CoordsSelectorConfig;
let OtherCommunityInfoConfig = class OtherCommunityInfoConfig {
    constructor(showInfo, showBorderForDebugging, localCommunityPolygon) {
        this.showInfo = showInfo;
        this.showBorderForDebugging = showBorderForDebugging;
        this.localCommunityPolygon = localCommunityPolygon;
    }
};
OtherCommunityInfoConfig = __decorate([
    __param(0, sparkson_1.Field("showInfo")),
    __param(1, sparkson_1.Field("showBorderForDebugging")),
    __param(2, sparkson_1.ArrayField("localCommunityPolygon", Coords)),
    __metadata("design:paramtypes", [Boolean, Boolean, Array])
], OtherCommunityInfoConfig);
exports.OtherCommunityInfoConfig = OtherCommunityInfoConfig;
let ClientConfig = class ClientConfig {
    constructor(community, legal, map, monitoring, coordsSelector, otherCommunityInfo, rootPath) {
        this.community = community;
        this.legal = legal;
        this.map = map;
        this.monitoring = monitoring;
        this.coordsSelector = coordsSelector;
        this.otherCommunityInfo = otherCommunityInfo;
        this.rootPath = rootPath;
    }
};
ClientConfig = __decorate([
    __param(0, sparkson_1.Field("community")),
    __param(1, sparkson_1.Field("legal")),
    __param(2, sparkson_1.Field("map")),
    __param(3, sparkson_1.Field("monitoring")),
    __param(4, sparkson_1.Field("coordsSelector")),
    __param(5, sparkson_1.Field("otherCommunityInfo")),
    __param(6, sparkson_1.Field("rootPath", true, undefined, "/")),
    __metadata("design:paramtypes", [CommunityConfig,
        LegalConfig,
        ClientMapConfig,
        MonitoringConfig,
        CoordsSelectorConfig,
        OtherCommunityInfoConfig, String])
], ClientConfig);
exports.ClientConfig = ClientConfig;
let Config = class Config {
    constructor(server, client) {
        this.server = server;
        this.client = client;
    }
};
Config = __decorate([
    __param(0, sparkson_1.Field("server")),
    __param(1, sparkson_1.Field("client")),
    __metadata("design:paramtypes", [ServerConfig,
        ClientConfig])
], Config);
exports.Config = Config;
//# sourceMappingURL=config.js.map