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

import com.google.gson.annotations.JsonAdapter;
import java.time.LocalDateTime;
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 Ratings {
  @BsonRepresentation(BsonType.OBJECT_ID)
  private String id;

  private String value = "";
  private String region = "";
  private Integer weight;

  @JsonAdapter(LocalDateTimeAdapter.class)
  private LocalDateTime createdAt;

  @JsonAdapter(LocalDateTimeAdapter.class)
  private LocalDateTime updatedAt;

  private Symbol symbol = new Symbol();

  public String getValue() {
    return value == null ? "" : value;
  }

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

  public Integer getWeight() {
    return weight == null ? 0 : weight;
  }
}
