# frozen_string_literal: true

# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

# DO NOT EDIT! This file is generated by rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb.
# Regenerate with: `bazel run //rb/lib/selenium/webdriver:bidi-generate`

module Selenium
  module WebDriver
    class BiDi
      module Protocol
        # @api private
        # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
        # @see https://w3c.github.io/webdriver-bidi/#module-emulation
        class Emulation < Domain
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationforcedcolorsmodetheme
          FORCED_COLORS_MODE_THEME = {
            light: 'light',
            dark: 'dark'
          }.freeze

          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationscreenorientationnatural
          SCREEN_ORIENTATION_NATURAL = {
            portrait: 'portrait',
            landscape: 'landscape'
          }.freeze

          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationscreenorientationtype
          SCREEN_ORIENTATION_TYPE = {
            portrait_primary: 'portrait-primary',
            portrait_secondary: 'portrait-secondary',
            landscape_primary: 'landscape-primary',
            landscape_secondary: 'landscape-secondary'
          }.freeze

          SET_SCROLLBAR_TYPE_OVERRIDE_PARAMETERS_SCROLLBAR_TYPE = {
            classic: 'classic',
            overlay: 'overlay'
          }.freeze

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsetforcedcolorsmodethemeoverrideparameters
          SetForcedColorsModeThemeOverrideParameters = Serialization::Record.define(
            theme: {wire_key: 'theme', nullable: true, enum: 'Emulation::FORCED_COLORS_MODE_THEME'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsetgeolocationoverrideparameters
          class SetGeolocationOverrideParameters < Serialization::Union
            presence(
              'Emulation::SetGeolocationOverrideParameters::Coordinates' => ['coordinates'],
              'Emulation::SetGeolocationOverrideParameters::Error' => ['error']
            )
            object_only

            # @api private
            # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
            Coordinates = Serialization::Record.define(
              contexts: {wire_key: 'contexts', required: false, list: true},
              user_contexts: {wire_key: 'userContexts', required: false, list: true},
              coordinates: {wire_key: 'coordinates', nullable: true, ref: 'Emulation::GeolocationCoordinates'}
            )

            # @api private
            # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
            Error = Serialization::Record.define(
              contexts: {wire_key: 'contexts', required: false, list: true},
              user_contexts: {wire_key: 'userContexts', required: false, list: true},
              error: {wire_key: 'error', ref: 'Emulation::GeolocationPositionError'}
            )
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationgeolocationcoordinates
          GeolocationCoordinates = Serialization::Record.define(
            latitude: {wire_key: 'latitude', primitive: 'number'},
            longitude: {wire_key: 'longitude', primitive: 'number'},
            accuracy: {wire_key: 'accuracy', required: false, primitive: 'number'},
            altitude: {wire_key: 'altitude', required: false, nullable: true, primitive: 'number'},
            altitude_accuracy: {wire_key: 'altitudeAccuracy', required: false, nullable: true, primitive: 'number'},
            heading: {wire_key: 'heading', required: false, nullable: true, primitive: 'number'},
            speed: {wire_key: 'speed', required: false, nullable: true, primitive: 'number'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationgeolocationpositionerror
          GeolocationPositionError = Serialization::Record.define(type: {fixed: 'positionUnavailable'})

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsetlocaleoverrideparameters
          SetLocaleOverrideParameters = Serialization::Record.define(
            locale: {wire_key: 'locale', nullable: true, primitive: 'string'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsetmediafeaturesoverrideparameters
          SetMediaFeaturesOverrideParameters = Serialization::Record.define(
            features: {wire_key: 'features', nullable: true, ref: 'Emulation::MediaFeature', list: true},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationmediafeature
          MediaFeature = Serialization::Record.define(
            name: {wire_key: 'name', primitive: 'string'},
            value: {wire_key: 'value', primitive: 'string'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsetnetworkconditionsparameters
          SetNetworkConditionsParameters = Serialization::Record.define(
            network_conditions: {
              wire_key: 'networkConditions',
              nullable: true,
              ref: 'Emulation::NetworkConditionsOffline'
            },
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationnetworkconditionsoffline
          NetworkConditionsOffline = Serialization::Record.define(type: {fixed: 'offline'})

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationscreenarea
          ScreenArea = Serialization::Record.define(
            width: {wire_key: 'width', primitive: 'integer'},
            height: {wire_key: 'height', primitive: 'integer'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsetscreensettingsoverrideparameters
          SetScreenSettingsOverrideParameters = Serialization::Record.define(
            screen_area: {wire_key: 'screenArea', nullable: true, ref: 'Emulation::ScreenArea'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationscreenorientation
          ScreenOrientation = Serialization::Record.define(
            natural: {wire_key: 'natural', enum: 'Emulation::SCREEN_ORIENTATION_NATURAL'},
            type: {wire_key: 'type', enum: 'Emulation::SCREEN_ORIENTATION_TYPE'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsetscreenorientationoverrideparameters
          SetScreenOrientationOverrideParameters = Serialization::Record.define(
            screen_orientation: {wire_key: 'screenOrientation', nullable: true, ref: 'Emulation::ScreenOrientation'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsetuseragentoverrideparameters
          SetUserAgentOverrideParameters = Serialization::Record.define(
            user_agent: {wire_key: 'userAgent', nullable: true, primitive: 'string'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsetviewportmetaoverrideparameters
          SetViewportMetaOverrideParameters = Serialization::Record.define(
            viewport_meta: {wire_key: 'viewportMeta', nullable: true, const: true},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsetscriptingenabledparameters
          SetScriptingEnabledParameters = Serialization::Record.define(
            enabled: {wire_key: 'enabled', nullable: true, const: false},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsetscrollbartypeoverrideparameters
          SetScrollbarTypeOverrideParameters = Serialization::Record.define(
            scrollbar_type: {
              wire_key: 'scrollbarType',
              nullable: true,
              enum: 'Emulation::SET_SCROLLBAR_TYPE_OVERRIDE_PARAMETERS_SCROLLBAR_TYPE'
            },
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsettimezoneoverrideparameters
          SetTimezoneOverrideParameters = Serialization::Record.define(
            timezone: {wire_key: 'timezone', nullable: true, primitive: 'string'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#cddl-type-emulationsettouchoverrideparameters
          SetTouchOverrideParameters = Serialization::Record.define(
            max_touch_points: {wire_key: 'maxTouchPoints', nullable: true, primitive: 'integer'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          def geolocation_coordinates(**) = GeolocationCoordinates.new(**)
          def geolocation_position_error(**) = GeolocationPositionError.new(**)
          def media_feature(**) = MediaFeature.new(**)
          def network_conditions_offline(**) = NetworkConditionsOffline.new(**)
          def screen_area(**) = ScreenArea.new(**)
          def screen_orientation(**) = ScreenOrientation.new(**)

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setForcedColorsModeThemeOverride
          def set_forced_colors_mode_theme_override(
            theme:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            Serialization.validate!('theme', theme, Emulation::FORCED_COLORS_MODE_THEME)
            params = SetForcedColorsModeThemeOverrideParameters.new(
              theme: theme,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setForcedColorsModeThemeOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setGeolocationOverride
          def set_geolocation_override(
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET,
            coordinates: Serialization::UNSET,
            error: Serialization::UNSET
          )
            params = SetGeolocationOverrideParameters.build(
              contexts: contexts,
              user_contexts: user_contexts,
              coordinates: coordinates,
              error: error
            )
            execute(cmd: 'emulation.setGeolocationOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setLocaleOverride
          def set_locale_override(locale:, contexts: Serialization::UNSET, user_contexts: Serialization::UNSET)
            params = SetLocaleOverrideParameters.new(locale: locale, contexts: contexts, user_contexts: user_contexts)
            execute(cmd: 'emulation.setLocaleOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setMediaFeaturesOverride
          def set_media_features_override(
            features:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            params = SetMediaFeaturesOverrideParameters.new(
              features: features,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setMediaFeaturesOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setNetworkConditions
          def set_network_conditions(
            network_conditions:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            params = SetNetworkConditionsParameters.new(
              network_conditions: network_conditions,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setNetworkConditions', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setScreenOrientationOverride
          def set_screen_orientation_override(
            screen_orientation:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            params = SetScreenOrientationOverrideParameters.new(
              screen_orientation: screen_orientation,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setScreenOrientationOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setScreenSettingsOverride
          def set_screen_settings_override(
            screen_area:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            params = SetScreenSettingsOverrideParameters.new(
              screen_area: screen_area,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setScreenSettingsOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setScriptingEnabled
          def set_scripting_enabled(enabled:, contexts: Serialization::UNSET, user_contexts: Serialization::UNSET)
            params = SetScriptingEnabledParameters.new(
              enabled: enabled,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setScriptingEnabled', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setScrollbarTypeOverride
          def set_scrollbar_type_override(
            scrollbar_type:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            Serialization.validate!(
              'scrollbarType',
              scrollbar_type,
              Emulation::SET_SCROLLBAR_TYPE_OVERRIDE_PARAMETERS_SCROLLBAR_TYPE
            )
            params = SetScrollbarTypeOverrideParameters.new(
              scrollbar_type: scrollbar_type,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setScrollbarTypeOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setTimezoneOverride
          def set_timezone_override(timezone:, contexts: Serialization::UNSET, user_contexts: Serialization::UNSET)
            params = SetTimezoneOverrideParameters.new(
              timezone: timezone,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setTimezoneOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setTouchOverride
          def set_touch_override(max_touch_points:, contexts: Serialization::UNSET, user_contexts: Serialization::UNSET)
            params = SetTouchOverrideParameters.new(
              max_touch_points: max_touch_points,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setTouchOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setUserAgentOverride
          def set_user_agent_override(user_agent:, contexts: Serialization::UNSET, user_contexts: Serialization::UNSET)
            params = SetUserAgentOverrideParameters.new(
              user_agent: user_agent,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setUserAgentOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://w3c.github.io/webdriver-bidi/#command-emulation-setViewportMetaOverride
          def set_viewport_meta_override(
            viewport_meta:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            params = SetViewportMetaOverrideParameters.new(
              viewport_meta: viewport_meta,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setViewportMetaOverride', params: params)
          end
        end # Emulation
      end # Protocol
    end # BiDi
  end # WebDriver
end # Selenium
