# 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/
        class UserAgentClientHints < Domain
          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://wicg.github.io/ua-client-hints/#cddl-type-useragentclienthintsclienthintsmetadata
          ClientHintsMetadata = Serialization::Record.define(
            brands: {wire_key: 'brands', required: false, ref: 'UserAgentClientHints::BrandVersion', list: true},
            full_version_list: {
              wire_key: 'fullVersionList',
              required: false,
              ref: 'UserAgentClientHints::BrandVersion',
              list: true
            },
            platform: {wire_key: 'platform', required: false, primitive: 'string'},
            platform_version: {wire_key: 'platformVersion', required: false, primitive: 'string'},
            architecture: {wire_key: 'architecture', required: false, primitive: 'string'},
            model: {wire_key: 'model', required: false, primitive: 'string'},
            mobile: {wire_key: 'mobile', required: false, primitive: 'boolean'},
            bitness: {wire_key: 'bitness', required: false, primitive: 'string'},
            wow64: {wire_key: 'wow64', required: false, primitive: 'boolean'},
            form_factors: {wire_key: 'formFactors', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          # @see https://wicg.github.io/ua-client-hints/#cddl-type-useragentclienthintsbrandversion
          BrandVersion = Serialization::Record.define(
            brand: {wire_key: 'brand', primitive: 'string'},
            version: {wire_key: 'version', primitive: 'string'}
          )

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

          def client_hints_metadata(**) = ClientHintsMetadata.new(**)
          def brand_version(**) = BrandVersion.new(**)

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_client_hints_override(
            client_hints:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            params = SetClientHintsOverrideCommandParams.new(
              client_hints: client_hints,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'userAgentClientHints.setClientHintsOverride', params: params)
          end
        end # UserAgentClientHints
      end # Protocol
    end # BiDi
  end # WebDriver
end # Selenium
