package com.yono.messeripos.models;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.room.Entity;
import androidx.room.PrimaryKey;

import com.google.gson.annotations.SerializedName;

@Entity(tableName = "carts")
public class ProductCartModels implements Parcelable {
    @PrimaryKey(autoGenerate = true)
    @SerializedName("id")
    private long id;

    @SerializedName("id_orders")
    private String id_orders;

    @SerializedName("quantity")
    private long quantity_orders;

    @SerializedName("quantity_stock")
    private long quantity_stock;

    @SerializedName("product_id")
    private int id_product_orders;

    @SerializedName("product_name")
    private String product_name_orders;

    @SerializedName("price")
    private long price_orders;

    @SerializedName("grand_total")
    private int grand_total_orders;

    public ProductCartModels(){

    }

    public ProductCartModels(String id_orders,
                             long quantity_orders,
                             int id_product_orders,
                             String product_name_orders,
                             long price_orders,
                             int quantity_stock) {
        this.id_orders = id_orders;
        this.quantity_orders = quantity_orders;
        this.id_product_orders = id_product_orders;
        this.product_name_orders = product_name_orders;
        this.price_orders = price_orders;
        this.quantity_stock = quantity_stock;
    }

    protected ProductCartModels(Parcel in) {
        id = in.readLong();
        id_orders = in.readString();
        quantity_orders = in.readLong();
        id_product_orders = in.readInt();
        product_name_orders = in.readString();
        price_orders = in.readLong();
        grand_total_orders = in.readInt();
    }

    public static final Creator<ProductCartModels> CREATOR = new Creator<ProductCartModels>() {
        @Override
        public ProductCartModels createFromParcel(Parcel in) {
            return new ProductCartModels(in);
        }

        @Override
        public ProductCartModels[] newArray(int size) {
            return new ProductCartModels[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeLong(id);
        parcel.writeString(id_orders);
        parcel.writeLong(quantity_orders);
        parcel.writeLong(price_orders);
        parcel.writeString(product_name_orders);
        parcel.writeInt(grand_total_orders);
    }

    public long getId() {
        return id;
    }

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

    public String getId_orders() {
        return id_orders;
    }

    public void setId_orders(String  id_orders) {
        this.id_orders = id_orders;
    }

    public long getQuantity_orders() {
        return quantity_orders;
    }

    public void setQuantity_orders(long quantity_orders) {
        this.quantity_orders = quantity_orders;
    }

    public int getId_product_orders() {
        return id_product_orders;
    }

    public void setId_product_orders(int id_product_orders) {
        this.id_product_orders = id_product_orders;
    }

    public String getProduct_name_orders() {
        return product_name_orders;
    }

    public void setProduct_name_orders(String product_name_orders) {
        this.product_name_orders = product_name_orders;
    }

    public long getPrice_orders() {
        return price_orders;
    }

    public void setPrice_orders(long price_orders) {
        this.price_orders = price_orders;
    }

    public int getGrand_total_orders() {
        return grand_total_orders;
    }

    public void setGrand_total_orders(int grand_total_orders) {
        this.grand_total_orders = grand_total_orders;
    }

    public long getQuantity_stock() {
        return quantity_stock;
    }

    public void setQuantity_stock(long quantity_stock) {
        this.quantity_stock = quantity_stock;
    }
}
