content: package com.bookstore.entity;
  
  import com.bookstore.event.CheckReviewEvent;
  
  import org.springframework.data.domain.AbstractAggregateRoot;
  
  import javax.persistence.Entity;
  import javax.persistence.EnumType;
  import javax.persistence.Enumerated;
  import javax.persistence.FetchType;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.JoinColumn;
  import javax.persistence.ManyToOne;
  import java.io.Serializable;
  
  @Entity
  public class BookReview extends AbstractAggregateRoot<BookReview> implements Serializable {
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
  
      private String content;
      private String email;
  
      @Enumerated(EnumType.STRING)
      private ReviewStatus status;
  
      @ManyToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "book_id")
      private Book book;
  
      public void registerReviewEvent() {
          registerEvent(new CheckReviewEvent(this));
      }
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public String getContent() {
          return content;
      }
  
      public void setContent(String content) {
          this.content = content;
      }
  
      public Book getBook() {
          return book;
      }
  
      public void setBook(Book book) {
          this.book = book;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      public ReviewStatus getStatus() {
          return status;
      }
  
      public void setStatus(ReviewStatus status) {
          this.status = status;
      }
  
      @Override
      public boolean equals(Object obj) {
          if (obj == null) {
              return false;
          }
          if (this == obj) {
              return true;
          }
          if (!(obj instanceof BookReview)) {
              return false;
          }
  
          return id != null && id.equals(((BookReview) obj).id);
      }
  
      @Override
      public int hashCode() {
          return 2021;
      }
  }
  