|
| 1 | +package me.proxer.library.entitiy.notifications; |
| 2 | + |
| 3 | +import com.squareup.moshi.Json; |
| 4 | +import lombok.Getter; |
| 5 | +import lombok.Value; |
| 6 | +import me.proxer.library.entitiy.ProxerDateItem; |
| 7 | +import me.proxer.library.entitiy.ProxerIdItem; |
| 8 | +import me.proxer.library.enums.NotificationType; |
| 9 | +import okhttp3.HttpUrl; |
| 10 | +import org.jetbrains.annotations.NotNull; |
| 11 | +import org.jetbrains.annotations.Nullable; |
| 12 | + |
| 13 | +import java.util.Date; |
| 14 | + |
| 15 | +/** |
| 16 | + * @author Ruben Gees |
| 17 | + */ |
| 18 | +@Value |
| 19 | +public class Notification implements ProxerIdItem, ProxerDateItem { |
| 20 | + |
| 21 | + /** |
| 22 | + * Returns the id. |
| 23 | + */ |
| 24 | + @Getter(onMethod = @__({@Override, @NotNull})) |
| 25 | + @Json(name = "id") |
| 26 | + private String id; |
| 27 | + |
| 28 | + /** |
| 29 | + * Returns the type of the notification. |
| 30 | + */ |
| 31 | + @Getter(onMethod = @__({@NotNull})) |
| 32 | + @Json(name = "type") |
| 33 | + private NotificationType type; |
| 34 | + |
| 35 | + /** |
| 36 | + * Returns the id of the content. This depends on the {@link #type}. |
| 37 | + */ |
| 38 | + @Getter(onMethod = @__({@NotNull})) |
| 39 | + @Json(name = "tid") |
| 40 | + private String contentId; |
| 41 | + |
| 42 | + /** |
| 43 | + * Returns the link to the content. |
| 44 | + */ |
| 45 | + @Getter(onMethod = @__({@NotNull})) |
| 46 | + @Json(name = "link") |
| 47 | + private HttpUrl contentLink; |
| 48 | + |
| 49 | + /** |
| 50 | + * Returns the description of the content. This is directly usable for presentation. |
| 51 | + */ |
| 52 | + @Getter(onMethod = @__({@NotNull})) |
| 53 | + @Json(name = "linktext") |
| 54 | + private String text; |
| 55 | + |
| 56 | + /** |
| 57 | + * Returns the time. |
| 58 | + */ |
| 59 | + @Getter(onMethod = @__({@Override, @NotNull})) |
| 60 | + @Json(name = "time") |
| 61 | + private Date date; |
| 62 | + |
| 63 | + /** |
| 64 | + * Returns additional info, depending on the {@link #type}. |
| 65 | + */ |
| 66 | + @Getter(onMethod = @__({@Nullable})) |
| 67 | + @Json(name = "description") |
| 68 | + private String additionalDescription; |
| 69 | +} |
0 commit comments