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, Watch } from '@stencil/core';
import { sanitizeVegaComponent } from '../../../utils/component';
import { InjectVegaGlobalSlimmer, InjectVegaSlimmer, methodPlaceholder, } from 'vega-slimmer/core';
import { VegaSelectionChipGroupRenderer } from './slimmers/renderers/vega-selection-chip-group-renderer';
import { VegaSelectionChipGroupValueController } from './slimmers/controllers/vega-selection-chip-group-value-controller';
import { VegaSelectionChipGroupItemsController } from './slimmers/controllers/vega-selection-chip-group-items-controller';
import { VegaComponentUsageRuntimeMetricsSlimmer } from '../../../helpers/slimmers/component-usage-runtime-metrics';
import { createSubStateNotifySlimmer } from '../../../helpers/slimmers/sub-state/sub-state-notify-slimmer';
import { VegaChange } from '../../../helpers/event-manager/event-id/vega-event-id';
import { ChildNodesEventPreventSlimmer } from '../../../helpers/event-manager/slimmers/child-nodes-event-prevent-slimmer';
import { FormFieldControllerSlimmer } from '../../../helpers/slimmers/form-field-controller-slimmer';
import { RequiredFieldRule } from '../../../helpers/validator/rules/required-field-rule';
import { createEventEmitSlimmer, } from '../../../helpers/event-manager/slimmers/event-emit-slimmer';
/**
 * @vegaVersion 2.22.0
 */
export class VegaSelectionChipGroup {
  constructor() {
    this.globalSlimmers = {};
    this.renderer = new VegaSelectionChipGroupRenderer();
    this.itemsController = new VegaSelectionChipGroupItemsController();
    this.valueController = new VegaSelectionChipGroupValueController();
    this.formFieldController = new FormFieldControllerSlimmer({
      propertyRules: [
        {
          propertyName: 'required',
          ruleFactory: (isRequired) => (isRequired ? new RequiredFieldRule() : null),
        },
      ],
      validationRulesName: 'validationRules',
      inputContainerGetter: () => this.renderer.getGroupContainerRef(),
      touchableAreaGetter: () => this.itemsController.getSelectionChipArray(),
      defaultValue: (target) => (target.selectType === 'checkbox' ? [] : ''),
      attributeGetter: (propertyName) => this[propertyName],
    });
    this.vegaComponentUsageRuntimeMetricsSlimmer = new VegaComponentUsageRuntimeMetricsSlimmer();
    this.changeEventEmitter = createEventEmitSlimmer(VegaSelectionChipGroup, VegaChange);
    this.valueNotifySlimmer = createSubStateNotifySlimmer(VegaSelectionChipGroup, 'value', 'watchValue');
    this.disabledNotifySlimmer = createSubStateNotifySlimmer(VegaSelectionChipGroup, 'disabled', 'watchDisabled');
    this.selectTypeNotifySlimmer = createSubStateNotifySlimmer(VegaSelectionChipGroup, 'selectType', 'watchSelectType');
    this.changeEventPrevent = new ChildNodesEventPreventSlimmer([VegaChange], () => this.host, true);
    /**
     * Specifies the label or title for the selection chip group.
     *    It provides descriptive text that helps identify
     *    the purpose of the selection chip group.
     *
     * @vegaVersion 2.22.0
     */
    this.label = '';
    /**
     * Determines the selection method for the chip group.
     *
     * @vegaVersion 2.22.0
     */
    this.selectType = 'radio';
    /**
     * Stores the selected values of the nested selection chips
     *    within the selection chip group.
     *
     * @vegaVersion 2.22.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.value = this.selectType === 'checkbox' ? [] : '';
    /**
     * Defines custom validation rules for the selection chip group field.
     *
     * @vegaVersion 2.22.0
     */
    this.validationRules = [];
    /**
     * Sets the validation status for the selection chip group.
     *
     * @vegaVersion 2.22.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.isValid = null;
  }
  watchSelectType() {
    methodPlaceholder();
  }
  watchValue() {
    methodPlaceholder();
  }
  watchDisabled() {
    methodPlaceholder();
  }
  watchValidationRules() {
    methodPlaceholder();
  }
  render() {
    return sanitizeVegaComponent(h(Host, null, this.renderer.render()), this.host);
  }
  static get is() { return "vega-selection-chip-group"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["vega-selection-chip-group.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["vega-selection-chip-group.css"]
  }; }
  static get properties() { return {
    "label": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.22.0"
          }],
        "text": "Specifies the label or title for the selection chip group.\n   It provides descriptive text that helps identify\n   the purpose of the selection chip group."
      },
      "attribute": "label",
      "reflect": false,
      "defaultValue": "''"
    },
    "hint": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.22.0"
          }],
        "text": "Provides a supplementary prompt message that\n   assists users in selecting the appropriate\n   value for the selection chip group."
      },
      "attribute": "hint",
      "reflect": false
    },
    "selectType": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "VegaSelectionChipGroupSelectType",
        "resolved": "\"checkbox\" | \"radio\"",
        "references": {
          "VegaSelectionChipGroupSelectType": {
            "location": "import",
            "path": "./interface"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.22.0"
          }],
        "text": "Determines the selection method for the chip group."
      },
      "attribute": "select-type",
      "reflect": false,
      "defaultValue": "'radio'"
    },
    "value": {
      "type": "string",
      "mutable": true,
      "complexType": {
        "original": "string | string[]",
        "resolved": "string | string[]",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.22.0"
          }],
        "text": "Stores the selected values of the nested selection chips\n   within the selection chip group."
      },
      "attribute": "value",
      "reflect": false,
      "defaultValue": "this.selectType === 'checkbox' ? [] : ''"
    },
    "required": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.22.0"
          }],
        "text": "Indicates whether at least one selection chip in the\n   selection chip group must be checked to pass\n   form validation."
      },
      "attribute": "required",
      "reflect": false
    },
    "disabled": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.22.0"
          }],
        "text": "Indicates if the selection chip group is disabled."
      },
      "attribute": "disabled",
      "reflect": false
    },
    "validationRules": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "FormFieldValidationRule<unknown>[]",
        "resolved": "FormFieldValidationRule<unknown>[]",
        "references": {
          "FormFieldValidationRule": {
            "location": "import",
            "path": "../../../helpers/validator/rules/form-field-validation-rule"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.22.0"
          }],
        "text": "Defines custom validation rules for the selection chip group field."
      },
      "defaultValue": "[]"
    },
    "isValid": {
      "type": "boolean",
      "mutable": true,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.22.0"
          }],
        "text": "Sets the validation status for the selection chip group."
      },
      "attribute": "is-valid",
      "reflect": true,
      "defaultValue": "null"
    }
  }; }
  static get events() { return [{
      "method": "vegaChange",
      "name": "vegaChange",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.22.0"
          }],
        "text": "An event emitter notifying changes in the value of the selection chip group,\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.22.0"
          }],
        "text": "An event emitter notifying changes in the value of the selection chip group,\n   whether triggered programmatically or through user interaction."
      },
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      }
    }]; }
  static get elementRef() { return "host"; }
  static get watchers() { return [{
      "propName": "selectType",
      "methodName": "watchSelectType"
    }, {
      "propName": "value",
      "methodName": "watchValue"
    }, {
      "propName": "disabled",
      "methodName": "watchDisabled"
    }, {
      "propName": "validationRules",
      "methodName": "watchValidationRules"
    }]; }
}
__decorate([
  InjectVegaGlobalSlimmer()
], VegaSelectionChipGroup.prototype, "globalSlimmers", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionChipGroup.prototype, "renderer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionChipGroup.prototype, "itemsController", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionChipGroup.prototype, "valueController", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionChipGroup.prototype, "formFieldController", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionChipGroup.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionChipGroup.prototype, "changeEventEmitter", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionChipGroup.prototype, "valueNotifySlimmer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionChipGroup.prototype, "disabledNotifySlimmer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionChipGroup.prototype, "selectTypeNotifySlimmer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaSelectionChipGroup.prototype, "changeEventPrevent", void 0);
