content: package shop.kkeujeok.kkeujeokbackend.dashboard.domain;
  
  import jakarta.persistence.CascadeType;
  import jakarta.persistence.Column;
  import jakarta.persistence.DiscriminatorColumn;
  import jakarta.persistence.Entity;
  import jakarta.persistence.EnumType;
  import jakarta.persistence.Enumerated;
  import jakarta.persistence.Inheritance;
  import jakarta.persistence.InheritanceType;
  import jakarta.persistence.JoinColumn;
  import jakarta.persistence.ManyToOne;
  import jakarta.persistence.OneToMany;
  import java.util.ArrayList;
  import java.util.List;
  import lombok.AccessLevel;
  import lombok.Getter;
  import lombok.NoArgsConstructor;
  import shop.kkeujeok.kkeujeokbackend.block.domain.Block;
  import shop.kkeujeok.kkeujeokbackend.global.entity.BaseEntity;
  import shop.kkeujeok.kkeujeokbackend.global.entity.Status;
  import shop.kkeujeok.kkeujeokbackend.member.domain.Member;
  
  @Entity
  @Getter
  @DiscriminatorColumn(name = "dtype")
  @Inheritance(strategy = InheritanceType.JOINED)
  @NoArgsConstructor(access = AccessLevel.PROTECTED)
  public class Dashboard extends BaseEntity {
  
      @Enumerated(value = EnumType.STRING)
      private Status status;
  
      private String title;
  
      @Column(columnDefinition = "TEXT")
      private String description;
  
      @Column(name = "dtype", insertable = false, updatable = false)
      private String dType;
  
      @ManyToOne
      @JoinColumn(name = "member_id")
      private Member member;
  
      @OneToMany(mappedBy = "dashboard", cascade = CascadeType.ALL, orphanRemoval = true)
      private List<Block> blocks = new ArrayList<>();
  
      public Dashboard(String title, String description, String dType, Member member) {
          this.status = Status.ACTIVE;
          this.title = title;
          this.description = description;
          this.dType = dType;
          this.member = member;
      }
  
      public void update(String updateTitle, String updateDescription) {
          this.title = updateTitle;
          this.description = updateDescription;
      }
  
      public void statusUpdate(Status status) {
          this.status = status;
      }
  
      public boolean isDeleted() {
          return status == Status.DELETED;
      }
  
  }
  