package com.hikapro.backpack.model.entities;

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

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

/**
 * Created by tariel on 02/04/16.
 */
public class Set implements Comparable<Set>, Serializable {

    @SerializedName("id")
    @Expose
    private int id;
    @SerializedName("item_ids")
    @Expose
    private List<Integer> items = new ArrayList<Integer>();
    @SerializedName("name")
    @Expose
    private String name;
    @SerializedName("photo")
    @Expose
    private String photo;
    @SerializedName("photo_thumb")
    @Expose
    private String photoThumb;
    @SerializedName("photo_thumbnail")
    @Expose
    private String photoThumbnail;

    private int lineNumber;
    private int packedQty;
    private int activeQty;

    public Set() {
    }

    public Set(int id, List<Integer> items, String name, String photo, String photoThumb, String photoThumbnail) {
        this.id = id;
        this.items = items;
        this.name = name;
        this.photo = photo;
        this.photoThumb = photoThumb;
        this.photoThumbnail = photoThumbnail;
    }

    public int getId() {
        return id;
    }

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

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

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

    public String getName() {
        return name;
    }

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

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    public String getPhotoThumb() {
        return photoThumb;
    }

    public void setPhotoThumb(String photoThumb) {
        this.photoThumb = photoThumb;
    }

    public String getPhotoThumbnail() {
        return photoThumbnail;
    }

    public void setPhotoThumbnail(String photoThumbnail) {
        this.photoThumbnail = photoThumbnail;
    }

    public int getLineNumber() {
        return lineNumber;
    }

    public void setLineNumber(int lineNumber) {
        this.lineNumber = lineNumber;
    }

    public int getPackedQty() {
        return packedQty;
    }

    public void setPackedQty(int packedQty) {
        this.packedQty = packedQty;
    }

    public int getActiveQty() {
        return activeQty;
    }

    public void setActiveQty(int activeQty) {
        this.activeQty = activeQty;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        return result;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Set that = (Set) o;

        if (id != that.id)
            return false;
        return true;
    }

    @Override
    public int compareTo(Set another) {
        int cmp = Integer.valueOf(lineNumber).compareTo(Integer.valueOf(another.lineNumber));
        return (cmp != 0 ? cmp : name.compareTo(another.name));
    }
}
