/*
 * (c) 2020 Pluto Inc.
 */
package tv.pluto.mongo.entities.sequencer;

import java.util.Collections;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bson.BsonType;
import org.bson.codecs.pojo.annotations.BsonRepresentation;
import tv.pluto.mongo.entities.episodes.AgeRange;
import tv.pluto.mongo.utils.json.SkipDeserialisation;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Episode {
  @BsonRepresentation(BsonType.OBJECT_ID)
  private String id;

  private String name = "";
  @SkipDeserialisation Series series;
  private Integer duration;
  private Integer allotment;
  private Integer adPodsDuration;
  private String category = "";
  private String subCategory = "";
  private String genre = "";
  private String subGenre = "";
  @SkipDeserialisation private List<Source> sources = Collections.emptyList();
  private Boolean dashEnabled;
  @SkipDeserialisation private List<AgeRange> ageRange = Collections.emptyList();
  private String activeRegion;

  public Integer getDuration() {
    return duration == null ? 0 : duration;
  }

  public Integer getAllotment() {
    return allotment == null ? 0 : allotment;
  }

  public Integer getAdPodsDuration() {
    return adPodsDuration == null ? 0 : adPodsDuration;
  }

  public Boolean getDashEnabled() {
    return dashEnabled != null && dashEnabled;
  }

  public String getName() {
    return name == null ? "" : name;
  }

  public String getCategory() {
    return category == null ? "" : category;
  }

  public String getSubCategory() {
    return subCategory == null ? "" : subCategory;
  }

  public String getGenre() {
    return genre == null ? "" : genre;
  }

  public String getSubGenre() {
    return subGenre == null ? "" : subGenre;
  }

  public String getActiveRegion() {
    return activeRegion == null ? "" : activeRegion;
  }
}
