package com.cristobalbernal.foro.Entidades;

import jakarta.persistence.*;

import java.sql.Timestamp;

@Entity
@Table(name = "respuestas", schema = "forogruas", catalog = "")
public class RespuestasEntity {
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    @Column(name = "id", nullable = false)
    private int id;
    @Basic
    @Column(name = "Post", nullable = true, length = 45)
    private String post;
    @Basic
    @Column(name = "fechaYHora", nullable = true)
    private Timestamp fechaYHora;
    @Basic
    @Column(name = "Respuestas_id", nullable = false)
    private int respuestasId;
    @Basic
    @Column(name = "users_id", nullable = false)
    private int usersId;
    @Basic
    @Column(name = "Foro_id", nullable = false)
    private int foroId;

    public int getId() {
        return id;
    }

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

    public String getPost() {
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    public Timestamp getFechaYHora() {
        return fechaYHora;
    }

    public void setFechaYHora(Timestamp fechaYHora) {
        this.fechaYHora = fechaYHora;
    }

    public int getRespuestasId() {
        return respuestasId;
    }

    public void setRespuestasId(int respuestasId) {
        this.respuestasId = respuestasId;
    }

    public int getUsersId() {
        return usersId;
    }

    public void setUsersId(int usersId) {
        this.usersId = usersId;
    }

    public int getForoId() {
        return foroId;
    }

    public void setForoId(int foroId) {
        this.foroId = foroId;
    }

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

        RespuestasEntity that = (RespuestasEntity) o;

        if (id != that.id) return false;
        if (respuestasId != that.respuestasId) return false;
        if (usersId != that.usersId) return false;
        if (foroId != that.foroId) return false;
        if (post != null ? !post.equals(that.post) : that.post != null) return false;
        if (fechaYHora != null ? !fechaYHora.equals(that.fechaYHora) : that.fechaYHora != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (post != null ? post.hashCode() : 0);
        result = 31 * result + (fechaYHora != null ? fechaYHora.hashCode() : 0);
        result = 31 * result + respuestasId;
        result = 31 * result + usersId;
        result = 31 * result + foroId;
        return result;
    }
}
