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 { MapToComponentField, VegaSlimmer } from 'vega-slimmer/core';
import ChangeManager from '../../../../helpers/change-manager/change-manager';
import { SELECTION_TILE_VALUE_CHANGE } from '../../../../helpers/change-manager/subject/static-subject/static-subject-title';
/**
 * The `VegaSelectionTileCheckedController` class in TypeScript manages the checked state of
 * a selection tile component.
 */
export class VegaSelectionTileCheckedController extends VegaSlimmer {
  /**
   * The function `setChecked` in TypeScript sets the `checked` property to the specified boolean value.
   *
   * @param {boolean} checked - The `checked` parameter is a boolean value that determines whether an
   * item is selected or not. It is used in the `setChecked` method to update the `checked` property of
   * an object to the specified boolean value.
   */
  setChecked(checked) {
    this.checked = checked;
  }
  /**
   * The `onCheck` function in TypeScript updates the value, emits a change event, and notifies the
   * change manager based on the checked status.
   *
   * @param {boolean} checked - The `checked` parameter is a boolean value that indicates whether a
   * checkbox or a similar input element is checked or not.
   */
  onCheck(checked) {
    const value = checked ? this.value : '';
    this.checked = checked;
    this.changeEventEmitter.emit(value);
    ChangeManager.notify(SELECTION_TILE_VALUE_CHANGE, {
      host: this.host,
      detail: {
        checked: checked,
        value: this.value,
      },
    });
  }
}
__decorate([
  MapToComponentField()
], VegaSelectionTileCheckedController.prototype, "host", void 0);
__decorate([
  MapToComponentField({ writable: true })
], VegaSelectionTileCheckedController.prototype, "checked", void 0);
__decorate([
  MapToComponentField()
], VegaSelectionTileCheckedController.prototype, "changeEventEmitter", void 0);
__decorate([
  MapToComponentField()
], VegaSelectionTileCheckedController.prototype, "value", void 0);
