// Path: src/main/java/uk/co/visalia/brightpearl/apiclient/util/StringUtils.java
// public final class StringUtils {
// 
//     private StringUtils() { }
// 
//     public static boolean isEmpty(String string) {
//         return string == null || string.length() == 0;
//     }
// 
//     public static boolean isNotEmpty(String string) {
//         return !isEmpty(string);
//     }
// 
//     public static boolean isBlank(String string) {
//         return string == null || string.trim().length() == 0;
//     }
// 
//     public static boolean isNotBlank(String string) {
//         return !isBlank(string);
//     }
// 
//     public static boolean equals(String lhs, String rhs) {
//         if ((lhs == null) != (rhs == null)) {
//             return false;
//         } else if (lhs == null && rhs == null) {
//             return true;
//         } else {
//             return lhs.equals(rhs);
//         }
//     }
// 
//     public static String join(Collection<String> strings, String separator) {
//         StringBuilder builder = new StringBuilder();
//         for (String string : strings) {
//             if (builder.length() > 0) {
//                 builder.append(separator);
//             }
//             builder.append(string);
//         }
//         return builder.toString();
//     }
// 
// }


import uk.co.visalia.brightpearl.apiclient.util.StringUtils;
import java.io.Serializable;
/*
 * Copyright 2014 David Morrissey
 *
 * Licensed 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 uk.co.visalia.brightpearl.apiclient.account;



/**
 * Represents the datacenter on which an account is hosted. Static instances are included representing the known datacenters,
 * and a customer datacenter can be created if required. To find the datacenter for an account, see the link below.
 *
 * @see <a href="http://www.brightpearl.com/developer/latest/concept/uri-syntax.html">http://www.brightpearl.com/developer/latest/concept/uri-syntax.html</a>
 */
public final class Datacenter implements Serializable {

    /**
     * Datacenter EU1 (GMT, CET).
     */
    public static final Datacenter EU1 = new Datacenter("EU1", "https://ws-eu1.brightpearl.com");

    /**
     * Datacenter EU2 (for accounts where admin domain is https://secure2.thisispearl.com).
     */
    public static final Datacenter EU2 = new Datacenter("EU2", "https://ws-eu2.brightpearl.com");

    /**
     * Datacenter USE (EST, CST).
     */
    public static final Datacenter USE = new Datacenter("USE", "https://ws-use.brightpearl.com");

    /**
     * Datacenter USW (PST, MST).
     */
    public static final Datacenter USW = new Datacenter("USW", "https://ws-usw.brightpearl.com");

    private static final Datacenter[] DATACENTERS = { EU1, EU2, USE, USW };

    private final String name;

    private final String host;

    /**
     * Create a custom datacenter.
     * @param name User friendly name of the datacenter. This is used for logging only; any non-null value is valid.
     * @param host Scheme and host name of the datacenter, e.g. https://ws-usw.brightpearl.com. Trailing slashes should be omitted.
     */
    public Datacenter(String name, String host) {
// Path: src/main/java/uk/co/visalia/brightpearl/apiclient/util/StringUtils.java
// public final class StringUtils {
// 
//     private StringUtils() { }
// 
//     public static boolean isEmpty(String string) {
//         return string == null || string.length() == 0;
//     }
// 
//     public static boolean isNotEmpty(String string) {
//         return !isEmpty(string);
//     }
// 
//     public static boolean isBlank(String string) {
//         return string == null || string.trim().length() == 0;
//     }
// 
//     public static boolean isNotBlank(String string) {
//         return !isBlank(string);
//     }
// 
//     public static boolean equals(String lhs, String rhs) {
//         if ((lhs == null) != (rhs == null)) {
//             return false;
//         } else if (lhs == null && rhs == null) {
//             return true;
//         } else {
//             return lhs.equals(rhs);
//         }
//     }
// 
//     public static String join(Collection<String> strings, String separator) {
//         StringBuilder builder = new StringBuilder();
//         for (String string : strings) {
//             if (builder.length() > 0) {
//                 builder.append(separator);
//             }
//             builder.append(string);
//         }
//         return builder.toString();
//     }
// 
// }


// Path: src/main/java/uk/co/visalia/brightpearl/apiclient/account/Datacenter.java
import uk.co.visalia.brightpearl.apiclient.util.StringUtils;
import java.io.Serializable;

/*
 * Copyright 2014 David Morrissey
 *
 * Licensed 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 uk.co.visalia.brightpearl.apiclient.account;



/**
 * Represents the datacenter on which an account is hosted. Static instances are included representing the known datacenters,
 * and a customer datacenter can be created if required. To find the datacenter for an account, see the link below.
 *
 * @see <a href="http://www.brightpearl.com/developer/latest/concept/uri-syntax.html">http://www.brightpearl.com/developer/latest/concept/uri-syntax.html</a>
 */
public final class Datacenter implements Serializable {

    /**
     * Datacenter EU1 (GMT, CET).
     */
    public static final Datacenter EU1 = new Datacenter("EU1", "https://ws-eu1.brightpearl.com");

    /**
     * Datacenter EU2 (for accounts where admin domain is https://secure2.thisispearl.com).
     */
    public static final Datacenter EU2 = new Datacenter("EU2", "https://ws-eu2.brightpearl.com");

    /**
     * Datacenter USE (EST, CST).
     */
    public static final Datacenter USE = new Datacenter("USE", "https://ws-use.brightpearl.com");

    /**
     * Datacenter USW (PST, MST).
     */
    public static final Datacenter USW = new Datacenter("USW", "https://ws-usw.brightpearl.com");

    private static final Datacenter[] DATACENTERS = { EU1, EU2, USE, USW };

    private final String name;

    private final String host;

    /**
     * Create a custom datacenter.
     * @param name User friendly name of the datacenter. This is used for logging only; any non-null value is valid.
     * @param host Scheme and host name of the datacenter, e.g. https://ws-usw.brightpearl.com. Trailing slashes should be omitted.
     */
    public Datacenter(String name, String host) {
        if (StringUtils.isBlank(name)) {