import '../../globals.js';
import optionize from '../../phet-core/js/optionize.js';
import { Text } from '../../scenery/js/imports.js';
import VerticalAquaRadioButtonGroup from '../../sun/js/VerticalAquaRadioButtonGroup.js';
import Tandem from '../../tandem/js/Tandem.js';
import PhetFont from './PhetFont.js';
import sceneryPhet from './sceneryPhet.js';
import SceneryPhetStrings from './SceneryPhetStrings.js';
import TimeSpeed from './TimeSpeed.js';
// maps TimeSpeed to its label and Tandem name
const SPEED_LABEL_MAP = new Map();
SPEED_LABEL_MAP.set(TimeSpeed.FAST, {
    stringProperty: SceneryPhetStrings.speed.fastStringProperty,
    tandemName: 'fastRadioButton'
});
SPEED_LABEL_MAP.set(TimeSpeed.NORMAL, {
    stringProperty: SceneryPhetStrings.speed.normalStringProperty,
    tandemName: 'normalRadioButton'
});
SPEED_LABEL_MAP.set(TimeSpeed.SLOW, {
    stringProperty: SceneryPhetStrings.speed.slowStringProperty,
    tandemName: 'slowRadioButton'
});
export default class TimeSpeedRadioButtonGroup extends VerticalAquaRadioButtonGroup {
    constructor(timeSpeedProperty, timeSpeeds, providedOptions) {
        const options = optionize()({
            // SelfOptions
            labelOptions: {
                font: new PhetFont(14),
                maxWidth: 130 // i18n
            },
            // VerticalAquaRadioButtonGroupOptions
            spacing: 9,
            // phetio
            tandem: Tandem.REQUIRED,
            tandemNameSuffix: 'RadioButtonGroup',
            // pdom
            labelTagName: 'h4',
            accessibleName: SceneryPhetStrings.a11y.timeControlNode.simSpeedsStringProperty,
            helpText: SceneryPhetStrings.a11y.timeControlNode.simSpeedDescriptionStringProperty
        }, providedOptions);
        // by default, radio buttons match height of label before maxWidth scaling adjustments
        if (!options.radioButtonOptions || options.radioButtonOptions.radius === undefined) {
            if (!options.radioButtonOptions) {
                options.radioButtonOptions = {};
            }
            options.radioButtonOptions.radius = new Text('test', options.labelOptions).height / 2;
        }
        const items = timeSpeeds.map(speed => {
            const stringProperty = SPEED_LABEL_MAP.get(speed).stringProperty;
            const item = {
                value: speed,
                createNode: () => new Text(stringProperty, options.labelOptions),
                tandemName: SPEED_LABEL_MAP.get(speed).tandemName,
                options: {
                    accessibleName: stringProperty
                }
            };
            return item;
        });
        super(timeSpeedProperty, items, options);
    }
}
sceneryPhet.register('TimeSpeedRadioButtonGroup', TimeSpeedRadioButtonGroup);
//# sourceMappingURL=TimeSpeedRadioButtonGroup.js.map