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



/**
 * Defines a Brightpearl customer account. There is no way to look up the datacenter that contains a unique account code,
 * so it must be configured.
 */
public final class Account implements Serializable {

    private final Datacenter datacenter;

    private final String accountCode;

    /**
     * Construct an account instance.
     * @param datacenter the datacenter that hosts the account.
     * @param accountCode the customer account code.
     */
    public Account(Datacenter datacenter, String accountCode) {
        if (datacenter == null || StringUtils.isBlank(datacenter.getHost()) || StringUtils.isBlank(datacenter.getName())) {
            throw new IllegalArgumentException("A datacenter name and host must be provided");
        }
        if (StringUtils.isBlank(accountCode)) {
            throw new IllegalArgumentException("An account code must be provided");
        }
        this.datacenter = datacenter;
        this.accountCode = accountCode;
    }

    /**
     * Returns the datacenter
     * @return the datacenter that hosts the account.
     */
    public Datacenter getDatacenter() {
        return datacenter;
    }

    public String getAccountCode() {
        return accountCode;
    }

    @Override
    public String toString() {
// 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/Account.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;



/**
 * Defines a Brightpearl customer account. There is no way to look up the datacenter that contains a unique account code,
 * so it must be configured.
 */
public final class Account implements Serializable {

    private final Datacenter datacenter;

    private final String accountCode;

    /**
     * Construct an account instance.
     * @param datacenter the datacenter that hosts the account.
     * @param accountCode the customer account code.
     */
    public Account(Datacenter datacenter, String accountCode) {
        if (datacenter == null || StringUtils.isBlank(datacenter.getHost()) || StringUtils.isBlank(datacenter.getName())) {
            throw new IllegalArgumentException("A datacenter name and host must be provided");
        }
        if (StringUtils.isBlank(accountCode)) {
            throw new IllegalArgumentException("An account code must be provided");
        }
        this.datacenter = datacenter;
        this.accountCode = accountCode;
    }

    /**
     * Returns the datacenter
     * @return the datacenter that hosts the account.
     */
    public Datacenter getDatacenter() {
        return datacenter;
    }

    public String getAccountCode() {
        return accountCode;
    }

    @Override
    public String toString() {
        return "Account{" +