import '../../globals.js';
// Copyright 2021-2024, University of Colorado Boulder
/**
 * An object that contains a value for each item in an enumeration.
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import EnumerationMap from './EnumerationMap.js';
import Orientation from './Orientation.js';
import phetCore from './phetCore.js';
class OrientationPair extends EnumerationMap {
    /**
     * @param horizontal - Value for the horizontal orientation
     * @param vertical - Value for the vertical orientation
     */
    constructor(horizontal, vertical) {
        super(Orientation, orientation => orientation === Orientation.HORIZONTAL ? horizontal : vertical);
    }
    get horizontal() {
        return this.get(Orientation.HORIZONTAL);
    }
    set horizontal(value) {
        this.set(Orientation.HORIZONTAL, value);
    }
    get vertical() {
        return this.get(Orientation.VERTICAL);
    }
    set vertical(value) {
        this.set(Orientation.VERTICAL, value);
    }
    with(orientation, value) {
        return new OrientationPair(orientation === Orientation.HORIZONTAL ? value : this.horizontal, orientation === Orientation.VERTICAL ? value : this.vertical);
    }
    /**
     * Creates an orientation pair based on a factory method.
     *
     * @param factory - called once for each orientation to determine
     *                             the value.
     */
    static create(factory) {
        return new OrientationPair(factory(Orientation.HORIZONTAL), factory(Orientation.VERTICAL));
    }
    /**
     * Returns a new EnumerationMap with mapped values.
     *
     * @param mapFunction - function( {*}, {TEnumeration.*} ): {*}
     * @returns With the mapped values
     */
    map(mapFunction) {
        return new OrientationPair(mapFunction(this.horizontal, Orientation.HORIZONTAL), mapFunction(this.vertical, Orientation.VERTICAL));
    }
}
phetCore.register('OrientationPair', OrientationPair);
export default OrientationPair;
//# sourceMappingURL=OrientationPair.js.map