// 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 com.google.common.base.Preconditions.checkNotNull;

import com.google.gson.JsonObject;

import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.io.IOException;


/**
 * Class to manage options specific to {@link EdgeDriver}.
 *
 * <p>Example usage:
 * <pre><code>
 * EdgeOptions options = new EdgeOptions()

 *
 * // For use with ChromeDriver:
 * EdgeDriver driver = new EdgeDriver(options);
 *
 * // or alternatively:
 * DesiredCapabilities capabilities = DesiredCapabilities.edge();
 * capabilities.setCapability(EdgeOptions.CAPABILITY, options);
 * EdgeDriver driver = new EdgeDriver(capabilities);
 *
 * // For use with RemoteWebDriver:
 * DesiredCapabilities capabilities = DesiredCapabilities.edge();
 * capabilities.setCapability(EdgeOptions.CAPABILITY, options);
 * RemoteWebDriver driver = new RemoteWebDriver(
 *     new URL("http://localhost:4444/wd/hub"), capabilities);
 * </code></pre>
 */
public class EdgeOptions {

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

	private String pageLoadStrategy;

	/**
	 * 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) {
      this.pageLoadStrategy = checkNotNull(strategy);
	}

	/**
	 * Converts this instance to its JSON representation.
	 *
	 * @return The JSON representation of the options.
	 * @throws IOException If an error occurred while reading the Edge extension files.
	 */
	public JsonObject toJson() throws IOException {
	  JsonObject options = new JsonObject();
	  if (this.pageLoadStrategy != null) {
		  options.addProperty(CapabilityType.PAGE_LOAD_STRATEGY, this.pageLoadStrategy);
	  }

	  return options;
	}

    /**
     * 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.
     */
    DesiredCapabilities toCapabilities() {
      DesiredCapabilities capabilities = DesiredCapabilities.edge();
	  if (this.pageLoadStrategy != null) {
          capabilities.setCapability(CapabilityType.PAGE_LOAD_STRATEGY, this.pageLoadStrategy);
	  }

      return capabilities;
    }
}

@@ -1215,16 +1215,18 @@
 tions()%0A
+ *
 %0A *%0A * /
@@ -1842,26 +1842,22 @@
 ions %7B%0A%0A
-  
   /**%0A
-  
    * Key
@@ -1924,20 +1924,16 @@
 ilities%7D
-%0A%09 *
  object.
@@ -1933,22 +1933,24 @@
 object.%0A
-%09
+  
  */%0A
-%09
+  
 public s
@@ -1997,17 +1997,18 @@
 ions%22;%0A%0A
-%09
+  
 private 
@@ -2033,22 +2033,24 @@
 ategy;%0A%0A
-%09
+  
 /**%0A
-%09
+  
  * Sets 
@@ -2082,21 +2082,23 @@
 r  Edge%0A
-%09 *%0A%09
+   *%0A  
  * Suppo
@@ -2214,22 +2214,24 @@
 or none%0A
-%09
+  
  */%0A
-%09
+  
 public v
@@ -2269,26 +2269,24 @@
 strategy) %7B%0A
-  
     this.pag
@@ -2329,18 +2329,21 @@
 y);%0A
-%09%7D%0A%0A%09
+  %7D%0A%0A  
 /**%0A
-%09
+  
  * C
@@ -2396,13 +2396,15 @@
 on.%0A
-%09 *%0A%09
+   *%0A  
  * @
@@ -2450,17 +2450,18 @@
 ptions.%0A
-%09
+  
  * @thro
@@ -2540,14 +2540,16 @@
 es.%0A
-%09
+  
  */%0A
-%09
+  
 publ
@@ -2592,17 +2592,18 @@
 ption %7B%0A
-%09
+  
   JsonOb
@@ -2631,25 +2631,26 @@
 onObject();%0A
-%09
+  
   if (this.p
@@ -2680,10 +2680,12 @@
 ) %7B%0A
-%09%09
+    
   op
@@ -2765,15 +2765,17 @@
 y);%0A
-%09
+  
   %7D%0A%0A
-%09
+  
   re
@@ -2792,22 +2792,19 @@
 ns;%0A
-%09
+  
 %7D%0A%0A
-  
   /**%0A
-  
    *
@@ -2871,23 +2871,16 @@
 luded as
-%0A     *
  capabil
@@ -2899,16 +2899,21 @@
 does not
+%0A   *
  copy th
@@ -2946,23 +2946,16 @@
  will be
-%0A     *
  reflect
@@ -2990,22 +2990,18 @@
 ies.%0A   
-  *%0A  
+*%0A
    * @re
@@ -3057,23 +3057,19 @@
 ons.%0A   
-  
 */%0A
-  
   Desire
@@ -3105,18 +3105,16 @@
 ) %7B%0A    
-  
 DesiredC
@@ -3168,17 +3168,18 @@
 edge();%0A
-%09
+  
   if (th
@@ -3215,20 +3215,16 @@
 %7B%0A      
-    
 capabili
@@ -3305,16 +3305,15 @@
 y);%0A
-%09
+  
   %7D%0A%0A
-  
     
@@ -3333,16 +3333,14 @@
 lities;%0A
-  
   %7D%0A%7D%0A

Reformat EdgeOptions. No logical changes.