public class WoodminContract {

    // Match <string name="content_authority" translatable="false">com.woodmin.app</string>
    public static final String CONTENT_AUTHORITY = "com.woodmin.app";
    public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);

    // For instance, content://com.woodmin.app/shop/
    public static final String PATH_SHOP = "shop";
    // For instance, content://com.woodmin.app/order/
    public static final String PATH_ORDER = "order";
    // For instance, content://com.woodmin.app/product/
    public static final String PATH_PRODUCT = "product";
    // For instance, content://com.woodmin.app/customer/
    public static final String PATH_CUSTOMER = "customer";

    public static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";

    public static String getDbDateString(Date date){
        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT, Locale.getDefault());
        return sdf.format(date);
    }

    public static final class ShopEntry implements BaseColumns {

        public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_SHOP).build();
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/" + CONTENT_AUTHORITY + "/" + PATH_SHOP;
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/" + CONTENT_AUTHORITY + "/" + PATH_SHOP;

        // Table name
        public static final String TABLE_NAME = "shop";

        //Fields
        public static final String COLUMN_NAME = "name";
        public static final String COLUMN_DESCRIPTION = "description";
        public static final String COLUMN_URL = "URL";
        public static final String COLUMN_WC_VERSION = "wc_version";
        public static final String COLUMN_META_TIMEZONE = "timezone";
        public static final String COLUMN_META_CURRENCY = "currency";
        public static final String COLUMN_META_CURRENCY_FORMAT = "currency_format";
        public static final String COLUMN_META_TAXI_INCLUDE = "tax_included";
        public static final String COLUMN_META_WEIGHT_UNIT = "weight_unit";
        public static final String COLUMN_META_DIMENSION_UNIT = "dimension_unit";

        public static Uri buildShopUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

    }

    public static final class OrdersEntry implements BaseColumns {

        public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_ORDER).build();
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/" + CONTENT_AUTHORITY + "/" + PATH_ORDER;
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/" + CONTENT_AUTHORITY + "/" + PATH_ORDER;

        // Table name
        public static final String TABLE_NAME = "orders";

        //Fields
        public static final String COLUMN_ID = "woocommerce_id";
        public static final String COLUMN_ORDER_NUMBER = "order_number";

        public static final String COLUMN_CREATED_AT = "created_at";
        public static final String COLUMN_UPDATED_AT = "updated_at";
        public static final String COLUMN_COMPLETED_AT = "completed_at";

        public static final String COLUMN_STATUS = "status";
        public static final String COLUMN_CURRENCY = "currency";
        public static final String COLUMN_TOTAL = "total";
        public static final String COLUMN_SUBTOTAL = "subtotal";
        public static final String COLUMN_TOTAL_LINE_ITEMS_QUANTITY = "total_line_items_quantity";
        public static final String COLUMN_TOTAL_TAX = "total_tax";
        public static final String COLUMN_TOTAL_SHIPPING = "total_shipping";
        public static final String COLUMN_CART_TAX = "cart_tax";
        public static final String COLUMN_SHIPPING_TAX = "shipping_tax";
        public static final String COLUMN_TOTAL_DISCOUNT = "total_discount";
        public static final String COLUMN_CART_DISCOUNT = "cart_discount";
        public static final String COLUMN_ORDER_DISCOUNT = "order_discount";
        public static final String COLUMN_SHIPPING_METHODS = "shipping_methods";

        public static final String COLUMN_NOTE = "note";
        public static final String COLUMN_VIEW_ORDER_URL = "view_order_url";

        public static final String COLUMN_PAYMENT_DETAILS_METHOD_ID = "method_id";
        public static final String COLUMN_PAYMENT_DETAILS_METHOD_TITLE = "method_title";
        public static final String COLUMN_PAYMENT_DETAILS_PAID = "paid";

        public static final String COLUMN_BILLING_FIRST_NAME = "billing_first_name";
        public static final String COLUMN_BILLING_LAST_NAME = "billing_last_name";
        public static final String COLUMN_BILLING_COMPANY = "billing_company";
        public static final String COLUMN_BILLING_ADDRESS_1 = "billing_address_1";
        public static final String COLUMN_BILLING_ADDRESS_2 = "billing_address_2";
        public static final String COLUMN_BILLING_CITY = "billing_city";
        public static final String COLUMN_BILLING_STATE = "billing_state";
        public static final String COLUMN_BILLING_POSTCODE = "billing_postcode";
        public static final String COLUMN_BILLING_COUNTRY = "billing_country";
        public static final String COLUMN_BILLING_EMAIL = "billing_email";
        public static final String COLUMN_BILLING_PHONE = "billing_phone";

        public static final String COLUMN_SHIPPING_FIRST_NAME = "shipping_first_name";
        public static final String COLUMN_SHIPPING_LAST_NAME = "shipping_last_name";
        public static final String COLUMN_SHIPPING_COMPANY = "shipping_company";
        public static final String COLUMN_SHIPPING_ADDRESS_1 = "shipping_address_1";
        public static final String COLUMN_SHIPPING_ADDRESS_2 = "shipping_address_2";
        public static final String COLUMN_SHIPPING_CITY = "shipping_city";
        public static final String COLUMN_SHIPPING_STATE = "shipping_state";
        public static final String COLUMN_SHIPPING_POSTCODE = "shipping_postcode";
        public static final String COLUMN_SHIPPING_COUNTRY = "shipping_country";

        public static final String COLUMN_CUSTOMER_ID = "customer_id";

        public static final String COLUMN_CUSTOMER_EMAIL = "customer_email";
        public static final String COLUMN_CUSTOMER_FIRST_NAME = "customer_first_name";
        public static final String COLUMN_CUSTOMER_LAST_NAME = "customer_last_name";
        public static final String COLUMN_CUSTOMER_USERNAME = "customer_username";
        public static final String COLUMN_CUSTOMER_LAST_ORDER_ID = "customer_last_order_id";
        public static final String COLUMN_CUSTOMER_LAST_ORDER_DATE = "customer_last_order_date";
        public static final String COLUMN_CUSTOMER_ORDERS_COUNT = "customer_orders_count";
        public static final String COLUMN_CUSTOMER_TOTAL_SPEND = "customer_total_spent";
        public static final String COLUMN_CUSTOMER_AVATAR_URL = "customer_avatar_url";

        public static final String COLUMN_CUSTOMER_BILLING_FIRST_NAME = "customer_billing_first_name";
        public static final String COLUMN_CUSTOMER_BILLING_LAST_NAME = "customer_billing_last_name";
        public static final String COLUMN_CUSTOMER_BILLING_COMPANY = "customer_billing_company";
        public static final String COLUMN_CUSTOMER_BILLING_ADDRESS_1 = "customer_billing_address_1";
        public static final String COLUMN_CUSTOMER_BILLING_ADDRESS_2 = "customer_billing_address_2";
        public static final String COLUMN_CUSTOMER_BILLING_CITY = "customer_billing_city";
        public static final String COLUMN_CUSTOMER_BILLING_STATE = "customer_billing_state";
        public static final String COLUMN_CUSTOMER_BILLING_POSTCODE = "customer_billing_postcode";
        public static final String COLUMN_CUSTOMER_BILLING_COUNTRY = "customer_billing_country";
        public static final String COLUMN_CUSTOMER_BILLING_EMAIL = "customer_billing_email";
        public static final String COLUMN_CUSTOMER_BILLING_PHONE = "customer_billing_phone";

        public static final String COLUMN_CUSTOMER_SHIPPING_FIRST_NAME = "customer_shipping_first_name";
        public static final String COLUMN_CUSTOMER_SHIPPING_LAST_NAME = "customer_shipping_last_name";
        public static final String COLUMN_CUSTOMER_SHIPPING_COMPANY = "customer_shipping_company";
        public static final String COLUMN_CUSTOMER_SHIPPING_ADDRESS_1 = "customer_shipping_address_1";
        public static final String COLUMN_CUSTOMER_SHIPPING_ADDRESS_2 = "customer_shipping_address_2";
        public static final String COLUMN_CUSTOMER_SHIPPING_CITY = "customer_shipping_city";
        public static final String COLUMN_CUSTOMER_SHIPPING_STATE = "customer_shipping_state";
        public static final String COLUMN_CUSTOMER_SHIPPING_POSTCODE = "customer_shipping_postcode";
        public static final String COLUMN_CUSTOMER_SHIPPING_COUNTRY = "customer_shipping_country";

        public static final String COLUMN_JSON = "json";
        public static final String COLUMN_ENABLE = "enable";

        public static Uri buildOrderUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

    }

    public static final class ProductEntry implements BaseColumns {

        public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_PRODUCT).build();
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/" + CONTENT_AUTHORITY + "/" + PATH_PRODUCT;
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/" + CONTENT_AUTHORITY + "/" + PATH_PRODUCT;

        // Table name
        public static final String TABLE_NAME = "product";

        //Fields
        public static final String COLUMN_ID = "id";
        public static final String COLUMN_TITLE = "title";
        public static final String COLUMN_SKU = "sku";
        public static final String COLUMN_PRICE = "price";
        public static final String COLUMN_STOCK = "stock";

        public static final String COLUMN_JSON = "json";
        public static final String COLUMN_ENABLE = "enable";

        public static Uri buildOrderUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

    }

    public static final class CustomerEntry implements BaseColumns {

        public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_CUSTOMER).build();
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/" + CONTENT_AUTHORITY + "/" + PATH_CUSTOMER;
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/" + CONTENT_AUTHORITY + "/" + PATH_CUSTOMER;

        // Table name
        public static final String TABLE_NAME = "customer";

        //Fields
        public static final String COLUMN_ID = "id";
        public static final String COLUMN_EMAIL = "email";
        public static final String COLUMN_FIRST_NAME = "first_name";
        public static final String COLUMN_LAST_NAME = "last_name";
        public static final String COLUMN_USERNAME = "username";
        public static final String COLUMN_LAST_ORDER_ID = "last_order_id";

        public static final String COLUMN_SHIPPING_FIRST_NAME = "shipping_first_name";
        public static final String COLUMN_SHIPPING_LAST_NAME = "shipping_last_name";
        public static final String COLUMN_SHIPPING_PHONE = "shipping_phone";

        public static final String COLUMN_BILLING_FIRST_NAME = "billing_first_name";
        public static final String COLUMN_BILLING_LAST_NAME = "billing_last_name";
        public static final String COLUMN_BILLING_PHONE = "billing_phone";

        public static final String COLUMN_JSON = "json";
        public static final String COLUMN_ENABLE = "enable";

        public static Uri buildOrderUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

    }

} public interface Woocommerce {


    @GET("wc-api/v3/")
    Call<Shop> getShop();

    @GET("wc-api/v3/orders/count")
    Call<Count> countOrders();

    @GET("wc-api/v3/orders")
    Call<Orders> getOrders(@QueryMap Map<String, String> options);

    @GET("wc-api/v3/orders/{orderId}/notes")
    Call<Notes> getOrdersNotes(@QueryMap Map<String, String> options,
                               @Path("orderId") String orderId);

    @PUT("wc-api/v3/orders/{orderId}")
    Call<OrderResponse> updateOrder(@Path("orderId") String orderId,
                                    @Body OrderUpdate order);

    @POST("wc-api/v3/orders")
    Call<OrderResponse> insertOrder(@Body OrderResponse order);

    @GET("wc-api/v3/products/count")
    Call<Count> countProducts();

    @GET("wc-api/v3/products")
    Call<Products> getProducts(@QueryMap Map<String, String> options);

    @GET("wc-api/v3/products/{productId}")
    Call<ProductResponse> getProduct(@Path("productId") int productId);

    @GET("wc-api/v3/customers/count")
    Call<Count> countCustomers();

    @GET("wc-api/v3/customers")
    Call<Customers> getCustomers(@QueryMap Map<String, String> options);




    @GET("wp-json/wc/v1/coupons")
    Call<ArrayList<Coupon>> getCoupons(@QueryMap Map<String, String> options);

    @POST("wp-json/wc/v1/orders")
    Call<Order> insertOrderV1(@Body Order order);

    @GET("wp-json/wc/v1/orders")
    Call<Order> getOrdersV1(@QueryMap Map<String, String> options);

    @PUT("wp-json/wc/v1/orders/{orderId}")
    Call<Order> updateOrderV1(@Path("orderId") String orderId,
                              @Body app.bennsandoval.com.woodmin.models.v1.orders.OrderUpdate order);

    /*
    @GET("wp-json/wc/v1/orders/count")
    Call<Count> countOrders();

    @GET("wp-json/wc/v1/wc-api/v3/orders/{orderId}/notes")
    Call<Notes> getOrdersNotes(@QueryMap Map<String, String> options,
                               @Path("orderId") String orderId);

    @GET("wp-json/wc/v1/wc-api/v3/products/count")
    Call<Count> countProducts();

    @GET("wp-json/wc/v1/wc-api/v3/products")
    Call<Products> getProducts(@QueryMap Map<String, String> options);

    @GET("wp-json/wc/v1/wc-api/v3/customers/count")
    Call<Count> countCustomers();

    @GET("wp-json/wc/v1/wc-api/v3/customers")
    Call<Customers> getCustomers(@QueryMap Map<String, String> options);

    @PUT("wp-json/wc/v1/wc-api/v3/orders/{orderId}")
    Call<OrderResponse> updateOrder(@Path("orderId") String orderId,
                                    @Body OrderUpdate order);

    @POST("wp-json/wc/v1/wc-api/v3/orders")
    Call<OrderResponse> insertOrder(@Body OrderResponse order);
    */
} public class Customers {

    private List<Customer> customers;

    public List<Customer> getCustomers() {
        return customers;
    }

    public void setCustomers(List<Customer> customers) {
        this.customers = customers;
    }
} public class Count {

    private String count;

    public String getCount() {
        return count;
    }

    public void setCount(String count) {
        this.count = count;
    }
} public class Customer {

    private int id;
    @SerializedName("created_at")
    private Date createdAt;
    private String email;
    @SerializedName("first_name")
    private String firstName;
    @SerializedName("last_name")
    private String lastName;
    private String username;
    @SerializedName("last_order_id")
    private String lastOrderId;
    @SerializedName("last_order_date")
    private Date lastOrderDate;
    @SerializedName("orders_count")
    private int ordersCount;
    @SerializedName("total_spent")
    private String totalSpent;
    @SerializedName("avatar_url")
    private String avatarUrl;

    @SerializedName("billing_address")
    private BillingAddress billingAddress;
    @SerializedName("shipping_address")
    private BillingAddress shippingAddress;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getLastOrderId() {
        return lastOrderId;
    }

    public void setLastOrderId(String lastOrderId) {
        this.lastOrderId = lastOrderId;
    }

    public Date getLastOrderDate() {
        return lastOrderDate;
    }

    public void setLastOrderDate(Date lastOrderDate) {
        this.lastOrderDate = lastOrderDate;
    }

    public int getOrdersCount() {
        return ordersCount;
    }

    public void setOrdersCount(int ordersCount) {
        this.ordersCount = ordersCount;
    }

    public String getTotalSpent() {
        return totalSpent;
    }

    public void setTotalSpent(String totalSpent) {
        this.totalSpent = totalSpent;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public BillingAddress getBillingAddress() {
        return billingAddress;
    }

    public void setBillingAddress(BillingAddress billingAddress) {
        this.billingAddress = billingAddress;
    }

    public BillingAddress getShippingAddress() {
        return shippingAddress;
    }

    public void setShippingAddress(BillingAddress shippingAddress) {
        this.shippingAddress = shippingAddress;
    }
} public class Order {

    private int id;
    @SerializedName("order_number")
    private String orderNumber;
    @SerializedName("created_at")
    private Date createdAt;
    @SerializedName("updated_at")
    private Date updatedAt;
    @SerializedName("completed_at")
    private Date completedAt;
    private String status;
    private String currency;
    private String total;
    private String subtotal;
    @SerializedName("total_line_items_quantity")
    private int totalLineItemsQuantity;
    @SerializedName("total_tax")
    private String totalTax;
    @SerializedName("total_shipping")
    private String totalShipping;
    @SerializedName("cart_tax")
    private String cartTax;
    @SerializedName("shipping_tax")
    private String shippingTax;
    @SerializedName("total_discount")
    private String totalDiscount;
    @SerializedName("cart_discount")
    private String cartDiscount;
    @SerializedName("order_discount")
    private String orderDiscount;
    @SerializedName("shipping_methods")
    private String shippingMethods;

    @SerializedName("payment_details")
    private PaymentDetails paymentDetails;
    @SerializedName("billing_address")
    private BillingAddress billingAddress;
    @SerializedName("shipping_address")
    private ShippingAddress shippingAddress;
    @SerializedName("shipping_lines")
    private List<ShippingLine> shippingLines = new ArrayList<>();


    private String note;
    @SerializedName("customer_ip")
    private String customerIp;
    @SerializedName("customer_user_agent")
    private String customerUserAgent;
    @SerializedName("customer_id")
    private String customerId;
    @SerializedName("view_order_url")
    private String viewOrderUrl;

    @SerializedName("line_items")
    private List<Item> items = new ArrayList<>();

    @SerializedName("coupon_lines")
    private List<CouponLine> couponLines = new ArrayList<>();

    private Customer customer;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Date getCompletedAt() {
        return completedAt;
    }

    public void setCompletedAt(Date completedAt) {
        this.completedAt = completedAt;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getTotal() {
        return total;
    }

    public void setTotal(String total) {
        this.total = total;
    }

    public String getSubtotal() {
        return subtotal;
    }

    public void setSubtotal(String subtotal) {
        this.subtotal = subtotal;
    }

    public int getTotalLineItemsQuantity() {
        return totalLineItemsQuantity;
    }

    public void setTotalLineItemsQuantity(int totalLineItemsQuantity) {
        this.totalLineItemsQuantity = totalLineItemsQuantity;
    }

    public String getTotalTax() {
        return totalTax;
    }

    public void setTotalTax(String totalTax) {
        this.totalTax = totalTax;
    }

    public String getTotalShipping() {
        return totalShipping;
    }

    public void setTotalShipping(String totalShipping) {
        this.totalShipping = totalShipping;
    }

    public String getCartTax() {
        return cartTax;
    }

    public void setCartTax(String cartTax) {
        this.cartTax = cartTax;
    }

    public String getShippingTax() {
        return shippingTax;
    }

    public void setShippingTax(String shippingTax) {
        this.shippingTax = shippingTax;
    }

    public String getTotalDiscount() {
        return totalDiscount;
    }

    public void setTotalDiscount(String totalDiscount) {
        this.totalDiscount = totalDiscount;
    }

    public String getCartDiscount() {
        return cartDiscount;
    }

    public void setCartDiscount(String cartDiscount) {
        this.cartDiscount = cartDiscount;
    }

    public String getOrderDiscount() {
        return orderDiscount;
    }

    public void setOrderDiscount(String orderDiscount) {
        this.orderDiscount = orderDiscount;
    }

    public String getShippingMethods() {
        return shippingMethods;
    }

    public void setShippingMethods(String shippingMethods) {
        this.shippingMethods = shippingMethods;
    }

    public PaymentDetails getPaymentDetails() {
        return paymentDetails;
    }

    public void setPaymentDetails(PaymentDetails paymentDetails) {
        this.paymentDetails = paymentDetails;
    }

    public BillingAddress getBillingAddress() {
        return billingAddress;
    }

    public void setBillingAddress(BillingAddress billingAddress) {
        this.billingAddress = billingAddress;
    }

    public ShippingAddress getShippingAddress() {
        return shippingAddress;
    }

    public void setShippingAddress(ShippingAddress shippingAddress) {
        this.shippingAddress = shippingAddress;
    }

    public List<ShippingLine> getShippingLines() {
        return shippingLines;
    }

    public void setShippingLines(List<ShippingLine> shippingLines) {
        this.shippingLines = shippingLines;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public String getCustomerIp() {
        return customerIp;
    }

    public void setCustomerIp(String customerIp) {
        this.customerIp = customerIp;
    }

    public String getCustomerUserAgent() {
        return customerUserAgent;
    }

    public void setCustomerUserAgent(String customerUserAgent) {
        this.customerUserAgent = customerUserAgent;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    public String getViewOrderUrl() {
        return viewOrderUrl;
    }

    public void setViewOrderUrl(String viewOrderUrl) {
        this.viewOrderUrl = viewOrderUrl;
    }

    public List<Item> getItems() {
        return items;
    }

    public void setItems(List<Item> items) {
        this.items = items;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public List<CouponLine> getCouponLines() {
        return couponLines;
    }

    public void setCouponLines(List<CouponLine> couponLines) {
        this.couponLines = couponLines;
    }
} public class Orders {

    private List<Order> orders;

    public List<Order> getOrders() {
        return orders;
    }

    public void setOrders(List<Order> orders) {
        this.orders = orders;
    }
} public class Images {

    private int id;
    @SerializedName("created_at")
    private Date createdAt;
    @SerializedName("updated_at")
    private Date updatedAt;
    private String src;
    private String title;
    private String alt;
    private int position;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public String getSrc() {
        return src;
    }

    public void setSrc(String src) {
        this.src = src;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getAlt() {
        return alt;
    }

    public void setAlt(String alt) {
        this.alt = alt;
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }
} public class Product {

    private String title;
    private int id;
    @SerializedName("created_at")
    private Date createdAt;
    @SerializedName("updated_at")
    private Date updatedAt;
    private String type;
    private String status;
    private boolean downloadable;
    private boolean virtual;
    private String permalink;
    private String sku;
    private String price;
    @SerializedName("regular_price")
    private String regularPrice;
    @SerializedName("sale_price")
    private String  salePrice;
    @SerializedName("price_html")
    private String priceHtml;
    private boolean taxable;
    @SerializedName("tax_status")
    private String taxStatus;
    @SerializedName("tax_class")
    private String taxClass;
    @SerializedName("managing_stock")
    private boolean managingStock;
    @SerializedName("stock_quantity")
    private int stockQuantity;
    @SerializedName("in_stock")
    private boolean inStock;
    @SerializedName("backorders_allowed")
    private boolean backordersAllowed;
    private boolean backordered;
    @SerializedName("sold_individually")
    private boolean soldIndividually;
    private boolean purchaseable;
    private boolean featured;
    private boolean visible;
    @SerializedName("catalog_visibility")
    private String catalogVisibility;
    @SerializedName("on_sale")
    private boolean onSale;
    private String weight;
    private Dimensions dimensions;
    @SerializedName("shipping_required")
    private boolean shippingRequired;
    @SerializedName("shipping_taxable")
    private boolean shippingTaxable;
    @SerializedName("shipping_class")
    private String shippingClass;
    @SerializedName("shipping_class_id")
    private int shippingClassId;
    private String description;
    @SerializedName("short_description")
    private String shortDescription;
    @SerializedName("reviews_allowed")
    private boolean reviewsAllowed;
    @SerializedName("average_rating")
    private String averageRating;
    @SerializedName("rating_count")
    private int ratingCount;
    @SerializedName("related_ids")
    private List<Integer> relatedIds;
    @SerializedName("upsell_ids")
    private List<Integer> upsellIds;
    @SerializedName("cross_sell_ids")
    private List<Integer> crossSellIds;
    @SerializedName("parent_id")
    private int parentId;
    private List<String> categories;
    private List<String> tags;
    private List<Images> images;
    @SerializedName("featured_src")
    private String featuredSrc;
    private List<Attributes> attributes;
    //"downloads": [],
    @SerializedName("download_limit")
    private int downloadLimit;
    @SerializedName("download_expiry")
    private int downloadExpiry;
    @SerializedName("download_type")
    private String downloadType;
    @SerializedName("purchase_note")
    private String purchaseNote;
    @SerializedName("total_sales")
    private int totalSales;
    private List<Variation> variations;
    //"parent": []
    @SerializedName("cogs_cost")
    private String cogsCost;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public boolean isDownloadable() {
        return downloadable;
    }

    public void setDownloadable(boolean downloadable) {
        this.downloadable = downloadable;
    }

    public boolean isVirtual() {
        return virtual;
    }

    public void setVirtual(boolean virtual) {
        this.virtual = virtual;
    }

    public String getPermalink() {
        return permalink;
    }

    public void setPermalink(String permalink) {
        this.permalink = permalink;
    }

    public String getSku() {
        return sku;
    }

    public void setSku(String sku) {
        this.sku = sku;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getRegularPrice() {
        return regularPrice;
    }

    public void setRegularPrice(String regularPrice) {
        this.regularPrice = regularPrice;
    }

    public String getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(String salePrice) {
        this.salePrice = salePrice;
    }

    public String getPriceHtml() {
        return priceHtml;
    }

    public void setPriceHtml(String priceHtml) {
        this.priceHtml = priceHtml;
    }

    public boolean isTaxable() {
        return taxable;
    }

    public void setTaxable(boolean taxable) {
        this.taxable = taxable;
    }

    public String getTaxStatus() {
        return taxStatus;
    }

    public void setTaxStatus(String taxStatus) {
        this.taxStatus = taxStatus;
    }

    public String getTaxClass() {
        return taxClass;
    }

    public void setTaxClass(String taxClass) {
        this.taxClass = taxClass;
    }

    public boolean isManagingStock() {
        return managingStock;
    }

    public void setManagingStock(boolean managingStock) {
        this.managingStock = managingStock;
    }

    public int getStockQuantity() {
        return stockQuantity;
    }

    public void setStockQuantity(int stockQuantity) {
        this.stockQuantity = stockQuantity;
    }

    public boolean isInStock() {
        return inStock;
    }

    public void setInStock(boolean inStock) {
        this.inStock = inStock;
    }

    public boolean isBackordersAllowed() {
        return backordersAllowed;
    }

    public void setBackordersAllowed(boolean backordersAllowed) {
        this.backordersAllowed = backordersAllowed;
    }

    public boolean isBackordered() {
        return backordered;
    }

    public void setBackordered(boolean backordered) {
        this.backordered = backordered;
    }

    public boolean isSoldIndividually() {
        return soldIndividually;
    }

    public void setSoldIndividually(boolean soldIndividually) {
        this.soldIndividually = soldIndividually;
    }

    public boolean isPurchaseable() {
        return purchaseable;
    }

    public void setPurchaseable(boolean purchaseable) {
        this.purchaseable = purchaseable;
    }

    public boolean isFeatured() {
        return featured;
    }

    public void setFeatured(boolean featured) {
        this.featured = featured;
    }

    public boolean isVisible() {
        return visible;
    }

    public void setVisible(boolean visible) {
        this.visible = visible;
    }

    public String getCatalogVisibility() {
        return catalogVisibility;
    }

    public void setCatalogVisibility(String catalogVisibility) {
        this.catalogVisibility = catalogVisibility;
    }

    public boolean isOnSale() {
        return onSale;
    }

    public void setOnSale(boolean onSale) {
        this.onSale = onSale;
    }

    public String getWeight() {
        return weight;
    }

    public void setWeight(String weight) {
        this.weight = weight;
    }

    public Dimensions getDimensions() {
        return dimensions;
    }

    public void setDimensions(Dimensions dimensions) {
        this.dimensions = dimensions;
    }

    public boolean isShippingRequired() {
        return shippingRequired;
    }

    public void setShippingRequired(boolean shippingRequired) {
        this.shippingRequired = shippingRequired;
    }

    public boolean isShippingTaxable() {
        return shippingTaxable;
    }

    public void setShippingTaxable(boolean shippingTaxable) {
        this.shippingTaxable = shippingTaxable;
    }

    public String getShippingClass() {
        return shippingClass;
    }

    public void setShippingClass(String shippingClass) {
        this.shippingClass = shippingClass;
    }

    public int getShippingClassId() {
        return shippingClassId;
    }

    public void setShippingClassId(int shippingClassId) {
        this.shippingClassId = shippingClassId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getShortDescription() {
        return shortDescription;
    }

    public void setShortDescription(String shortDescription) {
        this.shortDescription = shortDescription;
    }

    public boolean isReviewsAllowed() {
        return reviewsAllowed;
    }

    public void setReviewsAllowed(boolean reviewsAllowed) {
        this.reviewsAllowed = reviewsAllowed;
    }

    public String getAverageRating() {
        return averageRating;
    }

    public void setAverageRating(String averageRating) {
        this.averageRating = averageRating;
    }

    public int getRatingCount() {
        return ratingCount;
    }

    public void setRatingCount(int ratingCount) {
        this.ratingCount = ratingCount;
    }

    public List<Integer> getRelatedIds() {
        return relatedIds;
    }

    public void setRelatedIds(List<Integer> relatedIds) {
        this.relatedIds = relatedIds;
    }

    public List<Integer> getUpsellIds() {
        return upsellIds;
    }

    public void setUpsellIds(List<Integer> upsellIds) {
        this.upsellIds = upsellIds;
    }

    public List<Integer> getCrossSellIds() {
        return crossSellIds;
    }

    public void setCrossSellIds(List<Integer> crossSellIds) {
        this.crossSellIds = crossSellIds;
    }

    public int getParentId() {
        return parentId;
    }

    public void setParentId(int parentId) {
        this.parentId = parentId;
    }

    public List<String> getCategories() {
        return categories;
    }

    public void setCategories(List<String> categories) {
        this.categories = categories;
    }

    public List<String> getTags() {
        return tags;
    }

    public void setTags(List<String> tags) {
        this.tags = tags;
    }

    public List<Images> getImages() {
        return images;
    }

    public void setImages(List<Images> images) {
        this.images = images;
    }

    public String getFeaturedSrc() {
        return featuredSrc;
    }

    public void setFeaturedSrc(String featuredSrc) {
        this.featuredSrc = featuredSrc;
    }

    public List<Attributes> getAttributes() {
        return attributes;
    }

    public void setAttributes(List<Attributes> attributes) {
        this.attributes = attributes;
    }

    public int getDownloadLimit() {
        return downloadLimit;
    }

    public void setDownloadLimit(int downloadLimit) {
        this.downloadLimit = downloadLimit;
    }

    public int getDownloadExpiry() {
        return downloadExpiry;
    }

    public void setDownloadExpiry(int downloadExpiry) {
        this.downloadExpiry = downloadExpiry;
    }

    public String getDownloadType() {
        return downloadType;
    }

    public void setDownloadType(String downloadType) {
        this.downloadType = downloadType;
    }

    public String getPurchaseNote() {
        return purchaseNote;
    }

    public void setPurchaseNote(String purchaseNote) {
        this.purchaseNote = purchaseNote;
    }

    public int getTotalSales() {
        return totalSales;
    }

    public void setTotalSales(int totalSales) {
        this.totalSales = totalSales;
    }

    public List<Variation> getVariations() {
        return variations;
    }

    public void setVariations(List<Variation> variations) {
        this.variations = variations;
    }

    public String getCogsCost() {
        return cogsCost;
    }

    public void setCogsCost(String cogsCost) {
        this.cogsCost = cogsCost;
    }
} public class Products {

    private List<Product> products;

    public List<Product> getProducts() {
        return products;
    }

    public void setProducts(List<Product> products) {
        this.products = products;
    }
} public class Variation {

    private int id;
    @SerializedName("created_at")
    private Date createdAt;
    @SerializedName("updated_at")
    private Date updatedAt;
    private boolean downloadable;
    private boolean virtual;
    private String permalink;
    private String sku;
    private String price;
    @SerializedName("regular_price")
    private String regularPrice;
    @SerializedName("sale_price")
    private String  salePrice;
    private boolean taxable;
    @SerializedName("tax_status")
    private String taxStatus;
    @SerializedName("tax_class")
    private String taxClass;
    @SerializedName("managing_stock")
    private boolean managingStock;
    @SerializedName("stock_quantity")
    private int stockQuantity;
    @SerializedName("in_stock")
    private boolean inStock;
    private boolean backordered;
    private boolean purchaseable;
    private boolean visible;
    @SerializedName("on_sale")
    private boolean onSale;
    private String weight;
    private Dimensions dimensions;
    @SerializedName("shipping_class")
    private String shippingClass;
    @SerializedName("shipping_class_id")
    private int shippingClassId;
    //"downloads": [],
    private List<Images> image;
    private List<Attributes> attributes;
    @SerializedName("download_limit")
    private int downloadLimit;
    @SerializedName("download_expiry")
    private int downloadExpiry;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public boolean isDownloadable() {
        return downloadable;
    }

    public void setDownloadable(boolean downloadable) {
        this.downloadable = downloadable;
    }

    public boolean isVirtual() {
        return virtual;
    }

    public void setVirtual(boolean virtual) {
        this.virtual = virtual;
    }

    public String getPermalink() {
        return permalink;
    }

    public void setPermalink(String permalink) {
        this.permalink = permalink;
    }

    public String getSku() {
        return sku;
    }

    public void setSku(String sku) {
        this.sku = sku;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getRegularPrice() {
        return regularPrice;
    }

    public void setRegularPrice(String regularPrice) {
        this.regularPrice = regularPrice;
    }

    public String getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(String salePrice) {
        this.salePrice = salePrice;
    }

    public boolean isTaxable() {
        return taxable;
    }

    public void setTaxable(boolean taxable) {
        this.taxable = taxable;
    }

    public String getTaxStatus() {
        return taxStatus;
    }

    public void setTaxStatus(String taxStatus) {
        this.taxStatus = taxStatus;
    }

    public String getTaxClass() {
        return taxClass;
    }

    public void setTaxClass(String taxClass) {
        this.taxClass = taxClass;
    }

    public boolean isManagingStock() {
        return managingStock;
    }

    public void setManagingStock(boolean managingStock) {
        this.managingStock = managingStock;
    }

    public int getStockQuantity() {
        return stockQuantity;
    }

    public void setStockQuantity(int stockQuantity) {
        this.stockQuantity = stockQuantity;
    }

    public boolean isInStock() {
        return inStock;
    }

    public void setInStock(boolean inStock) {
        this.inStock = inStock;
    }

    public boolean isBackordered() {
        return backordered;
    }

    public void setBackordered(boolean backordered) {
        this.backordered = backordered;
    }

    public boolean isPurchaseable() {
        return purchaseable;
    }

    public void setPurchaseable(boolean purchaseable) {
        this.purchaseable = purchaseable;
    }

    public boolean isVisible() {
        return visible;
    }

    public void setVisible(boolean visible) {
        this.visible = visible;
    }

    public boolean isOnSale() {
        return onSale;
    }

    public void setOnSale(boolean onSale) {
        this.onSale = onSale;
    }

    public String getWeight() {
        return weight;
    }

    public void setWeight(String weight) {
        this.weight = weight;
    }

    public Dimensions getDimensions() {
        return dimensions;
    }

    public void setDimensions(Dimensions dimensions) {
        this.dimensions = dimensions;
    }

    public String getShippingClass() {
        return shippingClass;
    }

    public void setShippingClass(String shippingClass) {
        this.shippingClass = shippingClass;
    }

    public int getShippingClassId() {
        return shippingClassId;
    }

    public void setShippingClassId(int shippingClassId) {
        this.shippingClassId = shippingClassId;
    }

    public List<Images> getImage() {
        return image;
    }

    public void setImage(List<Images> image) {
        this.image = image;
    }

    public List<Attributes> getAttributes() {
        return attributes;
    }

    public void setAttributes(List<Attributes> attributes) {
        this.attributes = attributes;
    }

    public int getDownloadLimit() {
        return downloadLimit;
    }

    public void setDownloadLimit(int downloadLimit) {
        this.downloadLimit = downloadLimit;
    }

    public int getDownloadExpiry() {
        return downloadExpiry;
    }

    public void setDownloadExpiry(int downloadExpiry) {
        this.downloadExpiry = downloadExpiry;
    }
} public class Shop {

    private Store store;

    public Store getStore() {
        return store;
    }

    public void setStore(Store store) {
        this.store = store;
    }
} public class Utility {

    public static final String LOG_TAG = Utility.class.getSimpleName();

    public static String getPreferredUser(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getString(context.getString(R.string.pref_user_key),null);
    }

    public static String getPreferredSecret(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getString(context.getString(R.string.pref_secret_key),null);
    }

    public static Long getPreferredLastSync(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getLong(context.getString(R.string.pref_last_update_key), 0);
    }

    public static String getPreferredServer(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getString(context.getString(R.string.pref_server), null);
    }

    public static Long setPreferredLastSync(Context context, Long time) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putLong(context.getString(R.string.pref_last_update_key), time);
        editor.apply();
        return prefs.getLong(context.getString(R.string.pref_last_update_key), 0);
    }

    public static void setPreferredUserSecret(Context context, String user, String secret) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putString(context.getString(R.string.pref_user_key), user);
        editor.putString(context.getString(R.string.pref_secret_key), secret);
        editor.apply();
    }

    public static String setPreferredServer(Context context, String server) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putString(context.getString(R.string.pref_server), server);
        editor.apply();
        return prefs.getString(context.getString(R.string.pref_server),null);
    }

    public static String getPreferredShoppingCard(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getString(context.getString(R.string.pref_shopping_cart),null);
    }

    public static String setPreferredShoppingCard(Context context, String json) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putString(context.getString(R.string.pref_shopping_cart), json);
        editor.apply();
        return prefs.getString(context.getString(R.string.pref_shopping_cart),null);
    }

    public static SSLSocketFactory getSSLSocketFactory(){
        //TODO USE THIS ONLY FOR TESTING
        try {
            // Create a trust manager that does not validate certificate chains
            TrustManager[] trustAllCerts = new TrustManager[]{
                    new X509TrustManager() {
                        public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                            return new X509Certificate[0];
                        }

                        public void checkClientTrusted(X509Certificate[] certs, String authType) {
                        }

                        public void checkServerTrusted(X509Certificate[] certs, String authType) {
                        }
                    }
            };
            // Install the all-trusting trust manager
            SSLContext sc = SSLContext.getInstance("SSL");
            sc.init(null, trustAllCerts, new java.security.SecureRandom());
            return sc.getSocketFactory();
        }catch (Exception ex){

        }
        return null;
    }

    public static HostnameVerifier getHostnameVerifier(){
        //TODO USE THIS ONLY FOR TESTING
        // Create all-trusting host name verifier
        HostnameVerifier allHostsValid = new HostnameVerifier() {
            public boolean verify(String hostname, SSLSession session) {
                return true;
            }
        };
        return allHostsValid;
    }

}
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.SyncRequest;
import android.content.SyncResult;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Base64;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import app.bennsandoval.com.woodmin.R;
import app.bennsandoval.com.woodmin.data.WoodminContract;
import app.bennsandoval.com.woodmin.interfaces.Woocommerce;
import app.bennsandoval.com.woodmin.models.v3.customers.Customers;
import app.bennsandoval.com.woodmin.models.v3.orders.Count;
import app.bennsandoval.com.woodmin.models.v3.customers.Customer;
import app.bennsandoval.com.woodmin.models.v3.orders.Order;
import app.bennsandoval.com.woodmin.models.v3.orders.Orders;
import app.bennsandoval.com.woodmin.models.v3.products.Images;
import app.bennsandoval.com.woodmin.models.v3.products.Product;
import app.bennsandoval.com.woodmin.models.v3.products.Products;
import app.bennsandoval.com.woodmin.models.v3.products.Variation;
import app.bennsandoval.com.woodmin.models.v3.shop.Shop;
import app.bennsandoval.com.woodmin.utilities.Utility;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
                    protectedFromGarbageCollectorTargets.remove(this);
                }

                @Override
                public void onPrepareLoad(Drawable placeHolderDrawable) {
                }

            };
            protectedFromGarbageCollectorTargets.add(folderTarget);

            Picasso.with(getContext())
                    .load(image.getSrc())
                    .into(folderTarget);
        }
    }

    private void synchronizeCustomers(final Date date) {
        Log.v(LOG_TAG, "Customers sync start");

        /*
        Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        Bitmap bm = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.ic_media_play);
        Notification notification = new NotificationCompat.Builder(getContext())
            .setProgress(100, 0, false)
            .setContentTitle(getContext().getString(R.string.sync_customers))
            .setContentText(getContext().getString(R.string.sync_count, 0, 0))
            //.setStyle(new NotificationCompat.BigTextStyle()
            //        .bigText(getContext().getString(R.string.sync_customers)))
            //.setVisibility(Notification.VISIBILITY_PUBLIC)
            //.setVibrate(new long[]{0, 400})
            .setSmallIcon(R.drawable.ic_media_play)
            .setLargeIcon(bm)
            .setWhen(System.currentTimeMillis())
            .setSound(uri)
            .setAutoCancel(true)
            .build();
        NotificationManager notificationManager = (NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(2, notification);
        */

        if(date == null) {

            Call<Count> call = woocommerceApi.countCustomers();
            call.enqueue(new Callback<Count>() {
                @Override
                public void onResponse(Call<Count> call, retrofit2.Response<Count> response) {

                    int statusCode = response.code();
                    if (statusCode == 200) {
                        try {
                            sizeCustomers = Integer.valueOf(response.body().getCount());
                        } catch (NumberFormatException exception) {
                            Log.e(LOG_TAG, "NumberFormatException " + exception.getMessage());
                        }

                        /*
                        ContentValues values = new ContentValues();
                        values.put(WoodminContract.CustomerEntry.COLUMN_ENABLE, 0);
                        int ordersRowsDisabled = getContext().getContentResolver().update(WoodminContract.CustomerEntry.CONTENT_URI, values, null, null);
                        Log.v(LOG_TAG, "Customers " + ordersRowsDisabled + " disabled");
                        Log.v(LOG_TAG, "Customers " + sizeOrders + " to sync");
                        */
                        customersValues = new ArrayList<>();
                        synchronizeBatchCustomers(date);
                    }

                }

                @Override
                public void onFailure(Call<Count> call, Throwable t) {

                }
            });

        } else {
            synchronizeBatchCustomers(date);
        }
    }

    private void synchronizeBatchCustomers(final Date date) {

        Log.v(LOG_TAG, "Customers Total:" + sizeCustomers + " Current: " + pageCustomer * sizePageCustomer + " Page : " + pageCustomer);

        HashMap<String, String> options = new HashMap<>();
        options.put("filter[limit]", String.valueOf(sizePageCustomer));
        if(date != null) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            options.put("filter[updated_at_min]", dateFormat.format(date));
        }
        options.put("page", String.valueOf(pageCustomer));

        Call<Customers> call = woocommerceApi.getCustomers(options);
        call.enqueue(new Callback<Customers>() {
            @Override
            public void onResponse(Call<Customers> call, retrofit2.Response<Customers> response) {
                int statusCode = response.code();
                if (statusCode == 200) {
                    Log.v(LOG_TAG, "Success page Customer " + pageCustomer);

                    /*
                    //Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
                    Bitmap bm = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.ic_media_play);
                    Notification notification = new NotificationCompat.Builder(getContext())
                        .setProgress(sizeCustomers, (sizePageCustomer * pageCustomer), false)
                        .setContentTitle(getContext().getString(R.string.sync_customers))
                        .setContentText(getContext().getString(R.string.sync_count, (sizePageCustomer * pageCustomer), sizeCustomers))
                        //.setStyle(new NotificationCompat.BigTextStyle()
                                .bigText(getContext().getString(R.string.sync_customers)))
                        //.setVisibility(Notification.VISIBILITY_PUBLIC)
                        //.setVibrate(new long[]{0, 400})
                        //.setSound(uri)
                        .setSmallIcon(R.drawable.ic_media_play)
                        .setLargeIcon(bm)
                        .setWhen(System.currentTimeMillis())
                        .setAutoCancel(true)
                        .build();
                    NotificationManager notificationManager = (NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE);
                    notificationManager.notify(2, notification);
                    */

                    for (Customer customer : response.body().getCustomers()) {