// Copyright 2022-2025, University of Colorado Boulder
/**
 * A toggle switch for "Projector Mode". Changes the color scheme for better contrast on projectors. The sim must have
 * a projector mode color profile. This toggle switch appears in the PreferencesDialog in the Visual panel.
 *
 * @author Jesse Greenberg (PhET Interactive Simulations)
 */
import { string_joist_a11y_preferences_tabs_labelledDescriptionPattern_StringProperty } from '../strings/a11y/preferences/tabs/labelledDescriptionPattern.js';
import { string_joist_projectorMode_StringProperty } from '../strings/projectorMode.js';
import { string_joist_preferences_tabs_visual_projectorModeDescription_StringProperty } from '../strings/preferences/tabs/visual/projectorModeDescription.js';
import '../../../globals.js';
import '../../../chipper/js/browser/initialize-globals.js';
import { assert } from '../../../scenerystack/assert.js';
import PatternStringProperty from '../../../axon/js/PatternStringProperty.js';
import optionize, { combineOptions } from '../../../phet-core/js/optionize.js';
import VoicingText from '../../../scenery/js/accessibility/voicing/nodes/VoicingText.js';
import Text from '../../../scenery/js/nodes/Text.js';
import SceneryConstants from '../../../scenery/js/SceneryConstants.js';
import ToggleSwitch from '../../../sun/js/ToggleSwitch.js';
import Tandem from '../../../tandem/js/Tandem.js';
import joist from '../joist.js';
import PreferencesControl from './PreferencesControl.js';
import PreferencesDialogConstants from './PreferencesDialogConstants.js';
class ProjectorModeToggleSwitch extends PreferencesControl {
    constructor(colorProfileProperty, providedOptions) {
        assert && assert(phet.chipper.colorProfiles[0] !== SceneryConstants.PROJECTOR_COLOR_PROFILE &&
            phet.chipper.colorProfiles.includes(SceneryConstants.PROJECTOR_COLOR_PROFILE) &&
            phet.chipper.colorProfiles.length === 2 &&
            phet.chipper.colorProfiles[0] !== phet.chipper.colorProfiles[1], 'ProjectorModeToggleSwitch requires sims that support the projector color profile and one other color profile');
        const projectorModeLabel = new Text(string_joist_projectorMode_StringProperty, PreferencesDialogConstants.PANEL_SECTION_LABEL_OPTIONS);
        const projectorModeDescription = new VoicingText(string_joist_preferences_tabs_visual_projectorModeDescription_StringProperty, PreferencesDialogConstants.PANEL_SECTION_CONTENT_OPTIONS);
        // Identify the non-projector color profile that this checkbox sets.
        const otherColorProfile = phet.chipper.colorProfiles.find((colorProfile) => colorProfile !== SceneryConstants.PROJECTOR_COLOR_PROFILE);
        const projectorModeSwitch = new ToggleSwitch(colorProfileProperty, otherColorProfile, SceneryConstants.PROJECTOR_COLOR_PROFILE, combineOptions({
            accessibleName: string_joist_projectorMode_StringProperty
        }, PreferencesDialogConstants.TOGGLE_SWITCH_OPTIONS));
        const projectorModePatternStringProperty = new PatternStringProperty(string_joist_a11y_preferences_tabs_labelledDescriptionPattern_StringProperty, {
            label: string_joist_projectorMode_StringProperty,
            description: string_joist_preferences_tabs_visual_projectorModeDescription_StringProperty
        }, { tandem: Tandem.OPT_OUT });
        projectorModeDescription.readingBlockNameResponse = projectorModePatternStringProperty;
        const options = optionize()({
            labelNode: projectorModeLabel,
            descriptionNode: projectorModeDescription,
            controlNode: projectorModeSwitch
        }, providedOptions);
        super(options);
    }
}
joist.register('ProjectorModeToggleSwitch', ProjectorModeToggleSwitch);
export default ProjectorModeToggleSwitch;
