package ch.pizzalemon.android.model.cart;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * Created by cimenmus on 05/10/2017.
 */

public class CartProductModel implements Serializable {

    @Expose @SerializedName("cart_id") private String cartId;
    @Expose @SerializedName("product_id") private String productId;
    @Expose @SerializedName("categories") private ArrayList<String> categoryList;

    private String name;
    private String model;
    private String quantity;
    private String shipping;
    private String price;
    private String total;
    private boolean stock;
    private int reward;
    private ArrayList<CartProductOptionModel> option;

    private void checkNull(){

        if(cartId == null)
            cartId = "";

        if(productId == null)
            productId = "";

        if(name == null)
            name = "";

        if(model == null)
            model = "";

        if(quantity == null)
            quantity = "";

        if(shipping == null)
            shipping = "";

        if(price == null)
            price = "";

        if(total == null)
            total = "";

        if(option != null){
            for(CartProductOptionModel cartProductOptionModel : option){
                cartProductOptionModel.checkNull();
            }
        }

        if(categoryList == null){
            categoryList = new ArrayList<>();
        }
    }

    public static void checkNull(ArrayList<CartProductModel> cartProductList){
        for(CartProductModel cartProductModel : cartProductList){
            cartProductModel.checkNull();
        }
    }

    public String getCartId() {
        return cartId;
    }

    public void setCartId(String cartId) {
        this.cartId = cartId;
    }

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getQuantity() {
        return quantity;
    }

    public void setQuantity(String quantity) {
        this.quantity = quantity;
    }

    public String getShipping() {
        return shipping;
    }

    public void setShipping(String shipping) {
        this.shipping = shipping;
    }

    public String getPrice() {
        return price;
    }

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

    public String getTotal() {
        return total;
    }

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

    public boolean isStock() {
        return stock;
    }

    public void setStock(boolean stock) {
        this.stock = stock;
    }

    public int getReward() {
        return reward;
    }

    public void setReward(int reward) {
        this.reward = reward;
    }

    public ArrayList<CartProductOptionModel> getOption() {
        return option;
    }

    public void setOption(ArrayList<CartProductOptionModel> option) {
        this.option = option;
    }

    public ArrayList<String> getCategoryList() {
        return categoryList;
    }

    public void setCategoryList(ArrayList<String> categoryList) {
        this.categoryList = categoryList;
    }
}
