// 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.

package org.openqa.selenium.edge;

import static org.openqa.selenium.remote.CapabilityType.PAGE_LOAD_STRATEGY;

import com.google.common.collect.ImmutableMap;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.MutableCapabilities;
import org.openqa.selenium.Platform;
import org.openqa.selenium.Proxy;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.CapabilityType;

import java.util.Map;
import java.util.Objects;


/**
 * Class to manage options specific to {@link EdgeDriver}.
 *
 * <p>Example usage:
 * <pre><code>
 * EdgeOptions options = new EdgeOptions()
 *
 * // For use with EdgeDriver:
 * EdgeDriver driver = new EdgeDriver(options);
 *
 * // For use with RemoteWebDriver:
 * EdgeOptions options = new EdgeOptions();
 * RemoteWebDriver driver = new RemoteWebDriver(
 *     new URL("http://localhost:4444/wd/hub"), options);
 * </code></pre>
 */
public class EdgeOptions extends MutableCapabilities {

  /**
   * Key used to store a set of EdgeOptions in a {@link Capabilities} object.
   */
  public static final String CAPABILITY = "edgeOptions";

  public EdgeOptions() {
    setCapability(CapabilityType.BROWSER_NAME, BrowserType.EDGE);
    setCapability(CapabilityType.PLATFORM, Platform.WINDOWS);
  }

  @Override
  public EdgeOptions merge(Capabilities extraCapabilities) {
    super.merge(extraCapabilities);
    return this;
  }

  /**
   * Sets the page load strategy for  Edge
   *
   * Supported values are "normal", "eager" and "none"
   *
   * @param strategy strategy for page load: normal, eager or none
   */
  public void setPageLoadStrategy(String strategy) {
    setCapability(PAGE_LOAD_STRATEGY, Objects.requireNonNull(strategy));
  }

  public EdgeOptions setProxy(Proxy proxy) {
    setCapability(CapabilityType.PROXY, proxy);
    return this;
  }

  /**
   * Returns DesiredCapabilities for Edge with these options included as capabilities. This does not
   * copy the options. Further changes will be reflected in the returned capabilities.
   *
   * @return DesiredCapabilities for Edge with these options.
   * @deprecated These are already {@link MutableCapabilities}.
   */
  MutableCapabilities toCapabilities() {
    return this;
  }

  @Override
  public Map<String, Object> asMap() {
    return ImmutableMap.of(CAPABILITY, super.asMap());
  }
}

@@ -913,56 +913,8 @@
 Y;%0A%0A
-import com.google.common.collect.ImmutableMap;%0A%0A
 impo
@@ -942,32 +942,32 @@
 m.Capabilities;%0A
+
 import org.openq
@@ -1002,45 +1002,8 @@
 es;%0A
-import org.openqa.selenium.Platform;%0A
 impo
@@ -1134,30 +1134,8 @@
 e;%0A%0A
-import java.util.Map;%0A
 impo
@@ -1656,156 +1656,8 @@
  %7B%0A%0A
-  /**%0A   * Key used to store a set of EdgeOptions in a %7B@link Capabilities%7D object.%0A   */%0A  public static final String CAPABILITY = %22edgeOptions%22;%0A%0A
   pu
@@ -1747,70 +1747,8 @@
 E);%0A
-    setCapability(CapabilityType.PLATFORM, Platform.WINDOWS);%0A
   %7D%0A
@@ -2680,24 +2680,24 @@
 ilities() %7B%0A
+
     return t
@@ -2708,118 +2708,7 @@
 %0A  %7D
-%0A%0A  @Override%0A  public Map%3CString, Object%3E asMap() %7B%0A    return ImmutableMap.of(CAPABILITY, super.asMap());%0A  %7D
 %0A%7D%0A

Fix EdgeOptions to actually work