/**
 * Copyright © Volker Schukai and all contributing authors, {{copyRightYear}}. All rights reserved.
 * Node module: @schukai/monster
 *
 * This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
 * The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
 *
 * For those who do not wish to adhere to the AGPLv3, a commercial license is available.
 * Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
 * For more information about purchasing a commercial license, please contact Volker Schukai.
 *
 * SPDX-License-Identifier: AGPL-3.0
 */

import { instanceSymbol } from "../../constants.mjs";
import { registerCustomElement } from "../../dom/customelement.mjs";
import { CallButton } from "./call-button.mjs";

export { ToggleButton };

/**
 * The Toggle Button component is used toggle a other element wich has a method called toggle.
 *
 * @fragments /fragments/components/host/toggle-button/
 *
 * @example /examples/components/host/toggle-button-simple Toggle button
 *
 * @copyright Volker Schukai
 * @summary A specialized call button that triggers toggle behavior on a referenced target element.
 */
class ToggleButton extends CallButton {
	/**
	 * This method is called by the `instanceof` operator.
	 * @return {symbol}
	 */
	static get [instanceSymbol]() {
		return Symbol.for("@schukai/component-host/toggle-button@instance");
	}

	/**
	 * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
	 * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
	 *
	 * The individual configuration values can be found in the table.
	 *
	 * @property {Object} templates Template definitions
	 * @property {string} templates.main Main template
	 */
	get defaults() {
		return Object.assign({}, super.defaults, {
			call: "toggle",
		});
	}

	/**
	 *
	 * @return {string}
	 */
	static getTag() {
		return "monster-toggle-button";
	}
}

registerCustomElement(ToggleButton);
