package com.altimetrik.ee.demo.bean;

import java.sql.Timestamp;
import java.util.Date;

import java.util.Objects;
import javax.persistence.*;

@Entity
@Table(name = "stocks")
public class Stocks {

  @Id
  @Column(name = "stockQuote")
  String stockQuote;

  @Column(name = "companyName")
  String companyName;

  @Column(name = "date")
  Timestamp date;

  @Column(name = "price")
  Double price;

  @Column(name = "currency")
  String currency;

  public Stocks(String stockQuote, String companyName, Timestamp date, Double price,
      String currency) {
    this.stockQuote = stockQuote;
    this.companyName = companyName;
    this.date = date;
    this.price = price;
    this.currency = currency;
  }

  public Stocks() {
  }

  public String getStockQuote() {
    return stockQuote;
  }

  public String getCompanyName() {
    return companyName;
  }

  public Timestamp getDate() {
    return date;
  }

  public Double getPrice() {
    return price;
  }

  public String getCurrency() {
    return currency;
  }

  public void setStockQuote(String stockQuote) {
    this.stockQuote = stockQuote;
  }

  public void setCompanyName(String companyName) {
    this.companyName = companyName;
  }

  public void setDate(Timestamp date) {
    this.date = date;
  }

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

  public void setCurrency(String currency) {
    this.currency = currency;
  }

  @Override
  public String toString() {
    return "Stocks{" +
        "stockQuote='" + stockQuote + '\'' +
        ", companyName='" + companyName + '\'' +
        ", date=" + date +
        ", price=" + price +
        ", currency='" + currency + '\'' +
        '}';
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Stocks stocks = (Stocks) o;
    return Objects.equals(stockQuote, stocks.stockQuote) && Objects.equals(
        companyName, stocks.companyName) && Objects.equals(date, stocks.date)
        && Objects.equals(price, stocks.price) && Objects.equals(currency,
        stocks.currency);
  }

  @Override
  public int hashCode() {
    return Objects.hash(stockQuote, companyName, date, price, currency);
  }
}
