/**
 * @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';
export class DataPolicyEditorComponent {
    /**
     * @param {?} displayStateService
     * @param {?} webPlatformApiService
     */
    constructor(displayStateService, webPlatformApiService) {
        this.displayStateService = displayStateService;
        this.webPlatformApiService = webPlatformApiService;
        this.periods = [];
    }
    /**
     * @return {?}
     */
    ngOnInit() {
        this.initializeHeaders();
        this.webPlatformApiService.GetSecurableResources(this.displayStateService).subscribe(list => {
            this.securableResources = list;
            if (this.securableResources.length > 0) {
                this.securableResources.unshift('*');
            }
        });
    }
    /**
     * @return {?}
     */
    ngOnChanges() {
        this.initializeHeaders();
    }
    /**
     * @return {?}
     */
    initializeHeaders() {
        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 = () => [
    { type: DisplayStateService },
    { type: WebPlatformApiService }
];
DataPolicyEditorComponent.propDecorators = {
    selectedDataPolicy: [{ type: Input }]
};
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0YS1wb2x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