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 { Component, Host, Prop, h, Element, Event, State } from '@stencil/core';
import { sanitizeVegaComponent } from '../../utils/component';
import { InjectVegaGlobalSlimmer, InjectVegaSlimmer } from 'vega-slimmer/core';
import { VegaSelectionTileRenderer } from './slimmers/renderers/vega-selection-tile-renderer';
import { createEventEmitSlimmer, } from '../../helpers/event-manager/slimmers/event-emit-slimmer';
import { VegaChange } from '../../helpers/event-manager/event-id/vega-event-id';
import { VegaSelectionTileCheckedController } from './slimmers/controllers/vega-selection-tile-checked-cotroller';
import { VegaSelectionTileStateController } from './slimmers/controllers/vega-selection-tile-state-controller';
import { VegaSelectionTileShowErrorController } from './slimmers/controllers/vega-selection-tile-show-error-controller';
import { ChildNodesEventPreventSlimmer } from '../../helpers/event-manager/slimmers/child-nodes-event-prevent-slimmer';
import { CHECKBOX_VALUE_CHANGE, RADIO_VALUE_CHANGE, } from '../../helpers/change-manager/subject/static-subject/static-subject-title';
import { ChildNodesNotifyObserverSlimmer, } from '../../helpers/event-manager/slimmers/child-nodes-notify-observer-slimmer';
import { VegaComponentUsageRuntimeMetricsSlimmer } from '../../helpers/slimmers/component-usage-runtime-metrics';
/**
 * @vegaVersion 2.7.0
 */
export class VegaSelectionTile {
  constructor() {
    this.globalSlimmers = {};
    this.renderer = new VegaSelectionTileRenderer();
    this.checkedController = new VegaSelectionTileCheckedController();
    this.stateController = new VegaSelectionTileStateController();
    this.showErrorController = new VegaSelectionTileShowErrorController();
    this.changeEventEmitter = createEventEmitSlimmer(VegaSelectionTile, VegaChange);
    this.checkboxEventPrevent = new ChildNodesEventPreventSlimmer([VegaChange], () => this.renderer.getSelectorContainerRef());
    this.checkboxValueChangeObserver = new ChildNodesNotifyObserverSlimmer(CHECKBOX_VALUE_CHANGE, (payload) => this.checkedController.onCheck(payload.detail));
    this.radioValueChangeObserver = new ChildNodesNotifyObserverSlimmer(RADIO_VALUE_CHANGE, (payload) => {
      if (payload.detail) {
        this.checkedController.onCheck(payload.detail);
      }
    });
    this.vegaComponentUsageRuntimeMetricsSlimmer = new VegaComponentUsageRuntimeMetricsSlimmer();
    /**
     * Indicates whether the parent selection tile group shows error message.
     */
    this.showError = false;
    /**
     * Distribute vega-selection-tile components evenly to always cover the entire available width of the parent
     */
    this.distributeEvenly = false;
    /**
     * Specifies the text content of the title displayed
     *    within the selection tile.
     *
     * @vegaVersion 2.7.0
     */
    this.titleText = '';
    /**
     * Determines if the selection tile is disabled.
     *
     * @vegaVersion 2.7.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.disabled = false;
    /**
     * Determines the selection method for the tile. Options are:
     *
     * - `radio`:
     *      Displays a radio button for selection.
     * - `checkbox`:
     *      Displays a checkbox for selection.
     *
     * @vegaVersion 2.7.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.selectType = 'radio';
  }
  render() {
    return sanitizeVegaComponent(h(Host, { class: { 'distribute-evenly': this.distributeEvenly } }, this.renderer.render()), this.host);
  }
  static get is() { return "vega-selection-tile"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["vega-selection-tile.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["vega-selection-tile.css"]
  }; }
  static get properties() { return {
    "titleText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.7.0"
          }],
        "text": "Specifies the text content of the title displayed\n   within the selection tile."
      },
      "attribute": "title",
      "reflect": false,
      "defaultValue": "''"
    },
    "note": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.7.0"
          }],
        "text": "Specifies the text content of the note displayed\n   within the selection tile."
      },
      "attribute": "note",
      "reflect": false
    },
    "prefixIcon": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.7.0"
          }],
        "text": "Specifies the prefix icon displayed within the selection tile."
      },
      "attribute": "prefix-icon",
      "reflect": false
    },
    "disabled": {
      "type": "boolean",
      "mutable": true,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.7.0"
          }],
        "text": "Determines if the selection tile is disabled."
      },
      "attribute": "disabled",
      "reflect": false,
      "defaultValue": "false"
    },
    "checked": {
      "type": "boolean",
      "mutable": true,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.7.0"
          }],
        "text": "Determines if the selection tile is checked."
      },
      "attribute": "checked",
      "reflect": false
    },
    "selectType": {
      "type": "string",
      "mutable": true,
      "complexType": {
        "original": "'radio' | 'checkbox'",
        "resolved": "\"checkbox\" | \"radio\"",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.7.0"
          }],
        "text": "Determines the selection method for the tile. Options are:\n\n- `radio`:\n     Displays a radio button for selection.\n- `checkbox`:\n     Displays a checkbox for selection."
      },
      "attribute": "select-type",
      "reflect": false,
      "defaultValue": "'radio'"
    },
    "value": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": true,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.7.0"
          }],
        "text": "Determines the value that is associated with the selection-tile\n   when it is checked or unchecked."
      },
      "attribute": "value",
      "reflect": false
    }
  }; }
  static get states() { return {
    "showError": {},
    "distributeEvenly": {}
  }; }
  static get events() { return [{
      "method": "vegaChange",
      "name": "vegaChange",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.7.0"
          }],
        "text": "An event emitter notifying changes in the value of the selection tile,\n   whether triggered programmatically or through user interaction."
      },
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      }
    }, {
      "method": "change",
      "name": "change",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [{
            "name": "eventSemantics",
            "text": "namespace:native"
          }, {
            "name": "vegaVersion",
            "text": "2.7.0"
          }],
        "text": "An event emitter notifying changes in the value of the selection tile,\n   whether triggered programmatically or through user interaction."
      },
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      }
    }]; }
  static get elementRef() { return "host"; }
}
__decorate([
  InjectVegaGlobalSlimmer()
], VegaSelectionTile.prototype, "globalSlimmers", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionTile.prototype, "renderer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionTile.prototype, "checkedController", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionTile.prototype, "stateController", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionTile.prototype, "showErrorController", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionTile.prototype, "changeEventEmitter", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionTile.prototype, "checkboxEventPrevent", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionTile.prototype, "checkboxValueChangeObserver", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionTile.prototype, "radioValueChangeObserver", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionTile.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
