/*
 * (c) 2021 Pluto Inc.
 */
package tv.pluto.mongo.entities.samsungchannelproperties;

import com.google.gson.annotations.JsonAdapter;
import java.time.LocalDateTime;
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.utils.json.LocalDateTimeAdapter;

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

  @BsonRepresentation(BsonType.OBJECT_ID)
  private String channel;

  private String serviceId = "";
  private Boolean intilesEnabled;
  private String region = "";
  private List<Intile> intile = Collections.emptyList();

  @JsonAdapter(LocalDateTimeAdapter.class)
  private LocalDateTime createdAt;

  @JsonAdapter(LocalDateTimeAdapter.class)
  private LocalDateTime updatedAt;

  public String getChannel() {
    return channel == null ? "" : channel;
  }

  public String getServiceId() {
    return serviceId == null ? "" : serviceId;
  }

  public String getRegion() {
    return region == null ? "" : region;
  }

  public Boolean getIntilesEnabled() {
    return intilesEnabled != null && intilesEnabled;
  }
}
