// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import '//resources/cr_elements/cr_toggle/cr_toggle.js';
import '//resources/cr_elements/policy/cr_policy_indicator.js';
import '//resources/cr_elements/cr_icon/cr_icon.js';
import { CrLitElement } from 'chrome://resources/lit/v3_0/lit.rollup.js';
import { getCss } from './toggle_row.css.js';
import { getHtml } from './toggle_row.html.js';
export class ToggleRowElement extends CrLitElement {
    static get is() {
        return 'app-management-toggle-row';
    }
    static get styles() {
        return getCss();
    }
    render() {
        return getHtml.bind(this)();
    }
    static get properties() {
        return {
            icon: { type: String },
            label: { type: String },
            managed: {
                type: Boolean,
                reflect: true,
            },
            disabled: {
                type: Boolean,
                reflect: true,
            },
            value: {
                type: Boolean,
                reflect: true,
            },
            description: { type: String },
        };
    }
    #icon_accessor_storage = '';
    get icon() { return this.#icon_accessor_storage; }
    set icon(value) { this.#icon_accessor_storage = value; }
    #label_accessor_storage = '';
    get label() { return this.#label_accessor_storage; }
    set label(value) { this.#label_accessor_storage = value; }
    #managed_accessor_storage = false;
    get managed() { return this.#managed_accessor_storage; }
    set managed(value) { this.#managed_accessor_storage = value; }
    #disabled_accessor_storage = false;
    get disabled() { return this.#disabled_accessor_storage; }
    set disabled(value) { this.#disabled_accessor_storage = value; }
    #value_accessor_storage = false;
    get value() { return this.#value_accessor_storage; }
    set value(value) { this.#value_accessor_storage = value; }
    #description_accessor_storage = '';
    get description() { return this.#description_accessor_storage; }
    set description(value) { this.#description_accessor_storage = value; }
    firstUpdated() {
        this.addEventListener('click', this.onClick_);
    }
    isChecked() {
        return this.$.toggle.checked;
    }
    setToggle(value) {
        this.$.toggle.checked = value;
    }
    isDisabled_() {
        return this.disabled || this.managed;
    }
    onClick_(event) {
        event.stopPropagation();
        this.$.toggle.click();
    }
}
customElements.define(ToggleRowElement.is, ToggleRowElement);
