/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
 */
import { WebPlatformApiService } from './../../../../../services/WebPlatformApiService';
import { DisplayStateService } from './../../../../../services/DisplayStateService';
import { Component, Input } from '@angular/core';
var DataPolicyEditorComponent = /** @class */ (function () {
    function DataPolicyEditorComponent(displayStateService, webPlatformApiService) {
        this.displayStateService = displayStateService;
        this.webPlatformApiService = webPlatformApiService;
        this.periods = [];
    }
    /**
     * @return {?}
     */
    DataPolicyEditorComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        var _this = this;
        this.initializeHeaders();
        this.webPlatformApiService.GetSecurableResources(this.displayStateService).subscribe(function (list) {
            _this.securableResources = list;
            if (_this.securableResources.length > 0) {
                _this.securableResources.unshift('*');
            }
        });
    };
    /**
     * @return {?}
     */
    DataPolicyEditorComponent.prototype.ngOnChanges = /**
     * @return {?}
     */
    function () {
        this.initializeHeaders();
    };
    /**
     * @return {?}
     */
    DataPolicyEditorComponent.prototype.initializeHeaders = /**
     * @return {?}
     */
    function () {
        if (!this.selectedDataPolicy.customHeaders) {
            this.selectedDataPolicy.customHeaders = [];
        }
    };
    DataPolicyEditorComponent.decorators = [
        { type: Component, args: [{
                    selector: 'app-data-policy-editor',
                    template: "<tabset [justified]=\"true\">\r\n  <tab heading=\"Properties\">\r\n    <div class=\"form-group row\">\r\n      <label for=\"name\" class=\"col-sm-2 col-form-label tightPad\">Name</label>\r\n      <div class=\"col-sm-10 tightPad\">\r\n        <input class=\"form-control\" type=\"text\" [(ngModel)]=\"selectedDataPolicy.name\" id=\"name\">\r\n      </div>\r\n    </div>\r\n    <div class=\"form-group row\">\r\n      <label for=\"description\" class=\"col-sm-2 col-form-label tightPad\">Support Message</label>\r\n      <div class=\"col-sm-10 tightPad\">\r\n        <input class=\"form-control\" type=\"text\" [(ngModel)]=\"selectedDataPolicy.supportMessage\" id=\"supportMessage\">\r\n      </div>\r\n    </div>\r\n    <div class=\"form-group row\">\r\n      <label for=\"componentType\" class=\"col-sm-2 col-form-label tightPad\">Support Group</label>\r\n      <div class=\"col-sm-10 tightPad\">\r\n        <input class=\"form-control\" type=\"text\" [(ngModel)]=\"selectedDataPolicy.supportGroup\" id=\"supportGroup\">\r\n      </div>\r\n    </div>\r\n    <div class=\"form-group row\">\r\n      <label for=\"supportMessage\" class=\"col-sm-2 col-form-label tightPad\">Support Name List</label>\r\n      <div class=\"col-sm-10 tightPad\">\r\n        <input class=\"form-control\" type=\"text\" [(ngModel)]=\"selectedDataPolicy.supportNameList\" id=\"supportNameList\">\r\n      </div>\r\n    </div>\r\n    <div class=\"form-group row\">\r\n      <label for=\"sourceURL\" class=\"col-sm-2 col-form-label tightPad\"\r\n        tooltip=\"If 'Use Middle Layer Cache' is false, you can optionally specify context variables in the URL between {} and they will automatically be replaced with their current value.  \r\n        If the variable is missing an error toast will be raised. \r\n        Example: When RequestData is called for http://micron.com/{Source}/SomeResource it will become http://micron.com/LEHI/SomeResource before the http request is sent if the Context 'Source' was equal to 'LEHI'.\">\r\n        Support Data URI\r\n        <i class=\"fa fa-info-circle\"></i>\r\n      </label>\r\n      <div class=\"col-sm-10 tightPad\">\r\n        <input class=\"form-control\" type=\"text\" [(ngModel)]=\"selectedDataPolicy.sourceURL\" id=\"sourceURL\">\r\n      </div>\r\n    </div>\r\n    <div class=\"form-group row\">\r\n      <label for=\"supportMessage\" class=\"col-sm-2 col-form-label tightPad\">Design Id Column</label>\r\n      <div class=\"col-sm-10 tightPad\">\r\n        <input class=\"form-control\" type=\"text\" [(ngModel)]=\"selectedDataPolicy.DesignIdColumn\" id=\"DesignIdColumn\">\r\n      </div>\r\n    </div>\r\n    <div class=\"form-group row\">\r\n      <label for=\"useMiddleLayer\" class=\"col-sm-2 col-form-label tightPad\" \r\n        tooltip=\"If false this data policy is just a configuration store for the API info to be used by the widget.  Limited configuration is supported beyond Support Data URI.\">\r\n        Use Middle-Layer Cache?\r\n        <i class=\"fa fa-info-circle\"></i>\r\n      </label>\r\n      <div class=\"col-sm-10 tightPad\">\r\n        <select id=\"useMiddleLayer\" class=\"form-control\" [(ngModel)]=\"selectedDataPolicy.useMiddleLayer\">\r\n            <option [ngValue]=\"true\">True</option>\r\n            <option [ngValue]=\"false\">False</option>\r\n        </select>\r\n      </div>\r\n    </div>\r\n    <div *ngIf=\"!selectedDataPolicy.useMiddleLayer && selectedDataPolicy.useMiddleLayer !== undefined && !selectedDataPolicy.isAWebSocket\" class=\"form-group row\">\r\n      <label for=\"httpMethod\" class=\"col-sm-2 col-form-label tightPad\" \r\n        tooltip=\"If you want the API to use different HTTP methods select the method here.  Default is GET\">\r\n        HTTP Method?\r\n        <i class=\"fa fa-info-circle\"></i>\r\n      </label>\r\n      <div class=\"col-sm-10 tightPad\">\r\n        <select id=\"httpMethod\" class=\"form-control\" [(ngModel)]=\"selectedDataPolicy.httpMethod\">\r\n            <option [ngValue]=\"'get'\">GET</option>\r\n            <option [ngValue]=\"'put'\">PUT</option>\r\n            <option [ngValue]=\"'post'\">POST</option>\r\n            <option [ngValue]=\"'delete'\">DELETE</option>\r\n        </select>\r\n      </div>\r\n    </div>\r\n    <div *ngIf=\"!selectedDataPolicy.useMiddleLayer && selectedDataPolicy.useMiddleLayer !== undefined\" class=\"form-group row\">\r\n      <label for=\"useAPIStore\" class=\"col-sm-2 col-form-label tightPad\" \r\n        tooltip=\"If this Data Policy goes through the Micron API Gateway to get it's data additional configuration is required to handle tokens.  Default is false\">\r\n        From API Store?\r\n        <i class=\"fa fa-info-circle\"></i>\r\n      </label>\r\n      <div class=\"col-sm-10 tightPad\">\r\n        <select id=\"useAPIStore\" class=\"form-control\" [(ngModel)]=\"selectedDataPolicy.useAPIStore\">\r\n            <option [ngValue]=\"true\">True</option>\r\n            <option [ngValue]=\"false\">False</option>\r\n        </select>\r\n      </div>\r\n    </div>\r\n    <div *ngIf=\"selectedDataPolicy.useAPIStore && selectedDataPolicy.useAPIStore !== undefined\" class=\"form-group row\">\r\n      <label for=\"apiStoreAppKey\" class=\"col-sm-2 col-form-label tightPad\"\r\n        tooltip=\"To use API endpoint through the API store you must provide a valid subscribed app key for the API\">\r\n        API Store App Key\r\n        <i class=\"fa fa-info-circle\"></i>\r\n      </label>\r\n      <div class=\"col-sm-10 tightPad\">\r\n        <input class=\"form-control\" type=\"text\" [(ngModel)]=\"selectedDataPolicy.apiStoreAppKey\" id=\"apiStoreAppKey\">\r\n      </div>\r\n    </div>\r\n    <div *ngIf=\"selectedDataPolicy.useAPIStore && selectedDataPolicy.useAPIStore !== undefined\" class=\"form-group row\">\r\n      <label for=\"apiStoreSendToken\" class=\"col-sm-2 col-form-label tightPad\"\r\n        tooltip=\"Some API endpoint from Corp API store require a x-mt-adfs-openid header to be sent with them.  This token is captured from the adfs login so it can be sent as needed\">\r\n        Send x-mt-adfs-openid header\r\n        <i class=\"fa fa-info-circle\"></i>\r\n      </label>\r\n      <div class=\"col-sm-10 tightPad\">\r\n        <select id=\"apiStoreSendToken\" class=\"form-control\" [(ngModel)]=\"selectedDataPolicy.apiStoreSendMtAdfsOpenId\">\r\n            <option [ngValue]=\"true\">True</option>\r\n            <option [ngValue]=\"false\">False</option>\r\n        </select>\r\n      </div>\r\n    </div>\r\n    <div *ngIf=\"!selectedDataPolicy.useMiddleLayer && selectedDataPolicy.useMiddleLayer !== undefined\" class=\"form-group row\">\r\n      <label for=\"isAWebSocket\" class=\"col-sm-2 col-form-label tightPad\"\r\n        tooltip=\"This sets up the policy as a web socket that can be initialized via DisplayStateServices.GetWebSocketDataObj \r\n        which returns a WebSocketData object with observables for incoming message feeds.  The Support Data URI should be a ws://\">\r\n        Is a WebSocket?\r\n        <i class=\"fa fa-info-circle\"></i>\r\n      </label>\r\n      <div class=\"col-sm-10 tightPad\">\r\n        <select id=\"isAWebSocket\" class=\"form-control\" [(ngModel)]=\"selectedDataPolicy.isAWebSocket\">\r\n            <option [ngValue]=\"true\">True</option>\r\n            <option [ngValue]=\"false\">False</option>\r\n        </select>\r\n      </div>\r\n    </div>\r\n  </tab>\r\n\r\n  <ng-template #dpfixedParamsTooltip>\r\n    <b>Fixed Parameters:</b> These parameter name/values are ALWAYS sent with the data request\r\n  </ng-template>\r\n\r\n\r\n  <tab heading=\"Fixed\" [disabled]=\"!selectedDataPolicy.useMiddleLayer && selectedDataPolicy.useMiddleLayer !== undefined\">\r\n    <span class=\"label label-default\" [tooltip]=\"dpfixedParamsTooltip\" placement=\"top\"><i class=\"fa fa-info-circle\"></i>&nbsp;Hover for info</span>\r\n    <app-name-value-editor [nvArray]=\"selectedDataPolicy.fixedParameters\" [nameDisplay]=\"'Parameter Name'\" [valueDisplay]=\"'Value'\"></app-name-value-editor>\r\n\r\n  </tab>\r\n\r\n  <tab heading=\"Security\" *ngIf=\"securableResources && securableResources.length > 0\">\r\n    <b>Security:</b> If this data policy works with source data in the 'DataSet' format, you can specify rules for how to secure the data based on EPM rules \r\n    <ul>\r\n      <li><b>Securable resource type</b>: Select the EPM resource type  </li>\r\n      <li><b>Column</b>: Enter the name of the column that contains resource values of that type</li>\r\n    </ul>\r\n    <span>A note on asterisks</span>\r\n\r\n    <ul>\r\n        <li><b>Securable resource type</b>: An asterisk for this value will trigger the middle layer to try and evaluate all column names heuristically\r\n        against all securable resource types.  If this is an asterisk, it doesn't matter what the \"column\" value is  </li>\r\n        <li><b>Column</b>: An asterisk for this column will trigger the middle layer to evaluate all columns heuristically for a match of that type</li>\r\n        <li>If you you set DesignId and * as the values, the middle layer will look at the data set columns that are named 'design id', 'design_id', 'mfg_design_id', etc.</li>\r\n        <li>If you you set * and * as the values, the middle layer will look at the data set columns that are named for all the rules of each resource type.</li>\r\n        <li>the prefixes, suffixes, and core names used for matching each securable resource are in the middle layer web.base,config, and the execution of the matching can \r\n          be found in the middle layer CacheDataController.ApplySecurityFilteringRules() method.\r\n        </li>\r\n      </ul>\r\n    <app-name-value-editor [nvArray]=\"selectedDataPolicy.securableColumns\" [nameEnum]=\"securableResources\" [nameDisplay]=\"'Securable Resource Type'\" [valueDisplay]=\"'Column'\"></app-name-value-editor>\r\n  </tab>\r\n  \r\n  <ng-template #dpcolumnRenameMap>\r\n    <b>Column Rename:</b> Configuration for mapping the source data column names to the names seen by consumers of the data\r\n    policy\r\n  </ng-template>\r\n\r\n  <tab heading=\"Columns\" [disabled]=\"!selectedDataPolicy.useMiddleLayer && selectedDataPolicy.useMiddleLayer !== undefined\">\r\n    <span class=\"label label-default\" [tooltip]=\"dpcolumnRenameMap\" placement=\"top\"><i class=\"fa fa-info-circle\"></i>&nbsp;Hover for info</span>\r\n    <app-name-value-editor [nvArray]=\"selectedDataPolicy.columnRenameMap\" [nameDisplay]=\"'Original Column Name'\" [valueDisplay]=\"'New ColumnName'\"></app-name-value-editor>\r\n  </tab>\r\n\r\n  <tab heading=\"Caching\" [disabled]=\"!selectedDataPolicy.useMiddleLayer && selectedDataPolicy.useMiddleLayer !== undefined\">\r\n    <app-cache-rule-editor [cacheRules]=\"selectedDataPolicy.CacheRules\"></app-cache-rule-editor>\r\n  </tab>\r\n\r\n  <tab heading=\"Custom Headers\" [disabled]=\"!selectedDataPolicy.useMiddleLayer && selectedDataPolicy.useMiddleLayer !== undefined\">\r\n    <app-name-value-editor [nvArray]=\"selectedDataPolicy.customHeaders\" [nameDisplay]=\"'Header Name'\" [valueDisplay]=\"'Header Value'\"></app-name-value-editor>\r\n  </tab>\r\n\r\n  <tab heading=\"Raw\">\r\n    <pre>{{selectedDataPolicy | json}}</pre>\r\n  </tab>\r\n</tabset>",
                    styles: [""]
                }] }
    ];
    /** @nocollapse */
    DataPolicyEditorComponent.ctorParameters = function () { return [
        { type: DisplayStateService },
        { type: WebPlatformApiService }
    ]; };
    DataPolicyEditorComponent.propDecorators = {
        selectedDataPolicy: [{ type: Input }]
    };
    return DataPolicyEditorComponent;
}());
export { DataPolicyEditorComponent };
if (false) {
    /** @type {?} */
    DataPolicyEditorComponent.prototype.selectedDataPolicy;
    /** @type {?} */
    DataPolicyEditorComponent.prototype.periods;
    /** @type {?} */
    DataPolicyEditorComponent.prototype.securableResources;
    /** @type {?} */
    DataPolicyEditorComponent.prototype.displayStateService;
    /** @type {?} */
    DataPolicyEditorComponent.prototype.webPlatformApiService;
}

//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0YS1wb2xpY3ktZWRpdG9yLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL3dlYi1wbGF0Zm9ybS1saWJyYXJ5LyIsInNvdXJjZXMiOlsiY29tcG9uZW50cy93aWRnZXRzL2FkbWluL0VkaXRvcnMvZGF0YS1wb2xpY3ktZWRpdG9yL2RhdGEtcG9saWN5LWVkaXRvci5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLGlEQUFpRCxDQUFDO0FBQ3hGLE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxNQUFNLCtDQUErQyxDQUFDO0FBRXBGLE9BQU8sRUFBRSxTQUFTLEVBQVUsS0FBSyxFQUFhLE1BQU0sZUFBZSxDQUFDOztJQWNsRSxtQ0FBb0IsbUJBQXdDLEVBQVUscUJBQTRDO1FBQTlGLHdCQUFtQixHQUFuQixtQkFBbUIsQ0FBcUI7UUFBVSwwQkFBcUIsR0FBckIscUJBQXFCLENBQXVCO3VCQUY5RixFQUFFO0tBRWlHOzs7O0lBRXZILDRDQUFROzs7SUFBUjtRQUFBLGlCQVVDO1FBVEMsSUFBSSxDQUFDLGlCQUFpQixFQUFFLENBQUM7UUFFekIsSUFBSSxDQUFDLHFCQUFxQixDQUFDLHFCQUFxQixDQUFDLElBQUksQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDLFNBQVMsQ0FBQyxVQUFBLElBQUk7WUFDdkYsS0FBSSxDQUFDLGtCQUFrQixHQUFHLElBQUksQ0FBQztZQUMvQixFQUFFLENBQUMsQ0FBQyxLQUFJLENBQUMsa0JBQWtCLENBQUMsTUFBT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