content: package com.konsol.beatstream.domain;
  
  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  import jakarta.validation.constraints.*;
  import java.io.Serializable;
  import java.util.HashSet;
  import java.util.Set;
  import org.springframework.data.annotation.Id;
  import org.springframework.data.mongodb.core.mapping.DBRef;
  import org.springframework.data.mongodb.core.mapping.Document;
  import org.springframework.data.mongodb.core.mapping.Field;
  
  /**
   * A Playlist.
   */
  @Document(collection = "playlist")
  @SuppressWarnings("common-java:DuplicatedBlocks")
  public class Playlist implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @Id
      private String id;
  
      @NotNull
      @Field("title")
      private String title;
  
      @Field("description")
      private String description;
  
      @DBRef
      @Field("tracks")
      @JsonIgnoreProperties(value = { "artist", "album", "playlists" }, allowSetters = true)
      private Set<Track> tracks = new HashSet<>();
  
      @Field("ownerId")
      private String ownerId;
  
      // jhipster-needle-entity-add-field - JHipster will add fields here
  
      public String getId() {
          return this.id;
      }
  
      public Playlist id(String id) {
          this.setId(id);
          return this;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  
      public String getTitle() {
          return this.title;
      }
  
      public Playlist title(String title) {
          this.setTitle(title);
          return this;
      }
  
      public void setTitle(String title) {
          this.title = title;
      }
  
      public String getDescription() {
          return this.description;
      }
  
      public Playlist description(String description) {
          this.setDescription(description);
          return this;
      }
  
      public void setDescription(String description) {
          this.description = description;
      }
  
      public Set<Track> getTracks() {
          return this.tracks;
      }
  
      public void setTracks(Set<Track> tracks) {
          this.tracks = tracks;
      }
  
      public Playlist tracks(Set<Track> tracks) {
          this.setTracks(tracks);
          return this;
      }
  
      public Playlist addTrack(Track track) {
          this.tracks.add(track);
          return this;
      }
  
      public Playlist removeTrack(Track track) {
          this.tracks.remove(track);
          return this;
      }
  
      // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
  
      @Override
      public boolean equals(Object o) {
          if (this == o) {
              return true;
          }
          if (!(o instanceof Playlist)) {
              return false;
          }
          return getId() != null && getId().equals(((Playlist) o).getId());
      }
  
      @Override
      public int hashCode() {
          // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
          return getClass().hashCode();
      }
  
      // prettier-ignore
      @Override
      public String toString() {
          return "Playlist{" +
              "id=" + getId() +
              ", title='" + getTitle() + "'" +
              ", description='" + getDescription() + "'" +
              "}";
      }
  
      public String getOwnerId() {
          return ownerId;
      }
  
      public void setOwnerId(String ownerId) {
          this.ownerId = ownerId;
      }
  }
  