package com.kalyshev.yan.coffee.model;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

import java.util.Objects;

@Entity
@Table(name = "coffee")
public class Coffee {
    @Id
    @GeneratedValue
    private Long id;
    private String name;
    private Double cost;
    private String ingredients;
    public Coffee() {
    }
    public Coffee(String name, Double cost, String ingredients) {
        this.name = name;
        this.cost = cost;
        this.ingredients = ingredients;
    }

    public Long getId() {return id;}
    public String getName() {return name;}
    public void setName(String name) {this.name = name;}
    public Double getCost() {return cost;}
    public void setCost(Double cost) {this.cost = cost;}
    public String getIngredients() {return ingredients;}
    public void setIngredients(String ingredients) {this.ingredients = ingredients;}

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (!(o instanceof Coffee))
            return false;
        Coffee coffee = (Coffee) o;
        return Objects.equals(id, coffee.id) &&
                Objects.equals(this.name, coffee.name) &&
                Objects.equals(this.cost, coffee.cost) &&
                Objects.equals(this.ingredients, coffee.ingredients);
    }
    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
    @Override
    public String toString() {
        return "Coffee{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", cost='" + cost + '\'' +
                ", ingredients='" + ingredients + '\'' +
                '}';
    }
}
