package ru.job4j.tracker;

import java.util.Objects;

/**
 * Class for item.
 * @author Tolstonogov Alexey
 * @since 16.03.2018
 * @version 2.0
 */
public class Item {
    /**
     * Identifier.
     */
    private String id;

    /**
     * Name of item.
     */
    private String name;

    /**
     * Description of item.
     */
    private String description;

    /**
     * Comment to item.
     */
    private String comment;

    /**
     * Date of create of the item.
     */
    private long create;

    public Item(String id, String name, String description, String comment, long create) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.comment = comment;
        this.create = create;
    }

    /**
     * Constructor if item.
     * @param name Name
     * @param description Description
     * @param create Date of create
     */
    public Item(String name, String description, long create) {
        this.name = name;
        this.description = description;
        this.create = create;
    }

    public Item(String name, String description) {
        this.name = name;
        this.description = description;
    }

    /**
     * Returns name of item.
     * @return Name of item
     */
    public String getName() {
        return this.name;
    }

    /**
     * Returns description of item.
     * @return Description of item
     */
    public String getDescription() {
        return this.description;
    }

    /**
     * Returns comment to item.
     * @return Comment to item
     */
    public String getComment() {
        return this.comment;
    }

    /**
     * Returns date of create of the item.
     * @return Date of create of the item
     */
    public long getCreate() {
        return this.create;
    }

    /**
     * Returns identifier of the item.
     * @return Identifier of the item
     */
    public String getId() {
        return this.id;
    }

    /**
     * Sets identifier for the item.
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * Sets name for the item.
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Sets description for the item.
     */
    public void setDescription(String desc) {
        this.description = desc;
    }

    /**
     * Sets comment to item.
     */
    public void setComment(String comment) {
        this.comment = comment;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Item item = (Item) o;
        return create == item.create
                && Objects.equals(id, item.id)
                && Objects.equals(name, item.name)
                && Objects.equals(description, item.description)
                && Objects.equals(comment, item.comment);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, description, comment, create);
    }
}