import { Host, h } from '@stencil/core';
import { PersonalizedFilterUtils } from '../../subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils';
export class SnkFilterAssistentMode {
  constructor() {
    this.filterAssistent = undefined;
    this.messagesBuilder = undefined;
    this.filterId = undefined;
    this.entityUri = undefined;
    this.application = undefined;
    this.isDefaultFilter = false;
  }
  getMessage(key, params) {
    return this.application.messagesBuilder.getMessage(key, params);
  }
  async handleFilterGroupChange() {
    const assistent = await this._mainExpressionGroup.getExpressionGroup();
    this.filterAssistent = Object.assign(Object.assign({}, this.filterAssistent), { assistent });
    this.filterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this.filterAssistent.assistent);
    this.filterAssistent.expression = PersonalizedFilterUtils.buildGroupExpression(this.filterAssistent.assistent);
    this.ezChangeFilter.emit(this.filterAssistent);
  }
  render() {
    var _a, _b;
    return (h(Host, null, h("div", { class: "ez-padding-top--small snk-personalized-filter__group" }, h("snk-expression-group", { ref: (el) => this._mainExpressionGroup = el, group: (_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent, messagesBuilder: this.messagesBuilder, onEzFilterGroupChange: this.handleFilterGroupChange.bind(this), filterId: this.filterId, entityURI: this.entityUri, isDefaultFilter: this.isDefaultFilter })), h("div", { class: "ez-margin-top--auto" }, h("div", { class: "snk-personalized-filter__expression-input--line" }), h("ez-collapsible-box", { label: this.getMessage("snkPersonalizedFilter.info.titleCollapsible"), headerSize: "medium", value: true }, h("div", { class: "ez-box" }, h("div", { class: "ez-box__container--external" }, h("div", { class: "ez-box__container--internal" }, h("span", { class: "ez-box__container--title" }, this.getMessage("snkPersonalizedFilter.info.labelExpression")), h("span", { class: "ez-box__container--expression" }, (_b = this.filterAssistent) === null || _b === void 0 ? void 0 : _b.expression))))))));
  }
  static get is() { return "snk-filter-assistent-mode"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() {
    return {
      "$": ["snk-filter-assistent-mode.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["snk-filter-assistent-mode.css"]
    };
  }
  static get properties() {
    return {
      "filterAssistent": {
        "type": "unknown",
        "mutable": true,
        "complexType": {
          "original": "IPersonalizedFilter",
          "resolved": "IPersonalizedFilter",
          "references": {
            "IPersonalizedFilter": {
              "location": "import",
              "path": "../../interfaces/IPersonalizedFilter"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Propriedade que cont\u00E9m informa\u00E7\u00F5es do filtro personalizado."
        }
      },
      "messagesBuilder": {
        "type": "unknown",
        "mutable": true,
        "complexType": {
          "original": "SnkMessageBuilder",
          "resolved": "SnkMessageBuilder",
          "references": {
            "SnkMessageBuilder": {
              "location": "import",
              "path": "../../../../lib/message/SnkMessageBuilder"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
        }
      },
      "filterId": {
        "type": "string",
        "mutable": true,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Id do filtro que ser\u00E1 carregado."
        },
        "attribute": "filter-id",
        "reflect": false
      },
      "entityUri": {
        "type": "string",
        "mutable": true,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Respons\u00E1vel por receber a URI da entidade."
        },
        "attribute": "entity-uri",
        "reflect": false
      },
      "application": {
        "type": "unknown",
        "mutable": true,
        "complexType": {
          "original": "SnkApplication",
          "resolved": "SnkApplication",
          "references": {
            "SnkApplication": {
              "location": "import",
              "path": "../../../snk-application/snk-application"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Propriedade que mant\u00E9m informa\u00E7\u00F5es relacionadas ao SnkApplication."
        }
      },
      "isDefaultFilter": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define se o filtro em quest\u00E3o \u00E9 um filtro padr\u00E3o."
        },
        "attribute": "is-default-filter",
        "reflect": false,
        "defaultValue": "false"
      }
    };
  }
  static get events() {
    return [{
        "method": "ezChangeFilter",
        "name": "ezChangeFilter",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "complexType": {
          "original": "IPersonalizedFilter",
          "resolved": "IPersonalizedFilter",
          "references": {
            "IPersonalizedFilter": {
              "location": "import",
              "path": "../../interfaces/IPersonalizedFilter"
            }
          }
        }
      }];
  }
}
