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;
};
import { Injectable } from '@angular/core';
var sanitiseValue = function (rawValue) {
    if (typeof rawValue === 'string') {
        return rawValue.trim();
    }
    else if (typeof rawValue === 'number' && !isNaN(rawValue)) {
        return String(rawValue);
    }
    return '';
};
var ɵ0 = sanitiseValue;
var RequestOptionsBuilder = /** @class */ (function () {
    function RequestOptionsBuilder() {
    }
    RequestOptionsBuilder_1 = RequestOptionsBuilder;
    RequestOptionsBuilder.prototype.buildOptions = function (metaCriteria, caseCriteria, view) {
        var params = {};
        if (view) {
            params['view'] = view;
        }
        if (metaCriteria) {
            for (var _i = 0, _a = Object.keys(metaCriteria); _i < _a.length; _i++) {
                var criterion = _a[_i];
                params[criterion] = metaCriteria[criterion];
            }
        }
        if (caseCriteria) {
            for (var _b = 0, _c = Object.keys(caseCriteria); _b < _c.length; _b++) {
                var criterion = _c[_b];
                var value = sanitiseValue(caseCriteria[criterion]);
                if (value.length > 0) {
                    params[RequestOptionsBuilder_1.FIELD_PREFIX + criterion] = value;
                }
            }
        }
        var options = { params: params };
        return options;
    };
    var RequestOptionsBuilder_1;
    RequestOptionsBuilder.FIELD_PREFIX = 'case.';
    RequestOptionsBuilder = RequestOptionsBuilder_1 = __decorate([
        Injectable()
    ], RequestOptionsBuilder);
    return RequestOptionsBuilder;
}());
export { RequestOptionsBuilder };
export { ɵ0 };
//# sourceMappingURL=request.options.builder.js.map