001// Generated by delombok at Fri Oct 04 16:05:59 CEST 2024
002/*
003 * Copyright (c) 2010-2024 Mark Allen, Norbert Bartels.
004 *
005 * Permission is hereby granted, free of charge, to any person obtaining a copy
006 * of this software and associated documentation files (the "Software"), to deal
007 * in the Software without restriction, including without limitation the rights
008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
009 * copies of the Software, and to permit persons to whom the Software is
010 * furnished to do so, subject to the following conditions:
011 *
012 * The above copyright notice and this permission notice shall be included in
013 * all copies or substantial portions of the Software.
014 *
015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
021 * THE SOFTWARE.
022 */
023package com.restfb.types;
024
025import static java.util.Collections.unmodifiableList;
026import java.util.ArrayList;
027import java.util.Date;
028import java.util.List;
029import com.restfb.Facebook;
030
031/**
032 * Represents the <a href="http://developers.facebook.com/docs/reference/api/thread">Thread Graph API type</a>.
033 * 
034 * @since 1.7.0
035 */
036public class Thread extends FacebookType {
037  private static final long serialVersionUID = 1L;
038  @Facebook
039  private List<NamedFacebookType> to = new ArrayList<>();
040  @Facebook
041  private List<Message> comments = new ArrayList<>();
042  /**
043   * The amount of messages that are unread by the session profile.
044   * 
045   */
046  @Facebook
047  private Integer unread;
048  /**
049   * The amount of messages that are unseen by the session profile.
050   * 
051   */
052  @Facebook
053  private Integer unseen;
054  /**
055   * The time of the last comment on this post.
056   * 
057   */
058  @Facebook("updated_time")
059  private Date updatedTime;
060
061  /**
062   * The messages in this thread.
063   * 
064   * @return the messages in the thread
065   */
066  public List<Message> getComments() {
067    return unmodifiableList(comments);
068  }
069
070  public boolean addComment(Message comment) {
071    return comments.add(comment);
072  }
073
074  public boolean removeComment(Message comment) {
075    return comments.remove(comment);
076  }
077
078  /**
079   * A list of the Thread subscriber
080   * 
081   * @return A list of the thread subsscriber
082   */
083  public List<NamedFacebookType> getTo() {
084    return unmodifiableList(to);
085  }
086
087  public boolean addTo(NamedFacebookType subscriber) {
088    return to.add(subscriber);
089  }
090
091  public boolean removeTo(NamedFacebookType subscriber) {
092    return to.remove(subscriber);
093  }
094
095  /**
096   * The amount of messages that are unread by the session profile.
097   * 
098   * @return the amount of messages that are unread
099   */
100  @java.lang.SuppressWarnings("all")
101  public Integer getUnread() {
102    return this.unread;
103  }
104
105  /**
106   * The amount of messages that are unread by the session profile.
107   * 
108   */
109  @java.lang.SuppressWarnings("all")
110  public void setUnread(final Integer unread) {
111    this.unread = unread;
112  }
113
114  /**
115   * The amount of messages that are unseen by the session profile.
116   * 
117   * @return the amount of messages that are unseen
118   */
119  @java.lang.SuppressWarnings("all")
120  public Integer getUnseen() {
121    return this.unseen;
122  }
123
124  /**
125   * The amount of messages that are unseen by the session profile.
126   * 
127   */
128  @java.lang.SuppressWarnings("all")
129  public void setUnseen(final Integer unseen) {
130    this.unseen = unseen;
131  }
132
133  /**
134   * The time of the last comment on this post.
135   * 
136   * @return The time of the last comment on this post.
137   */
138  @java.lang.SuppressWarnings("all")
139  public Date getUpdatedTime() {
140    return this.updatedTime;
141  }
142
143  /**
144   * The time of the last comment on this post.
145   * 
146   */
147  @java.lang.SuppressWarnings("all")
148  public void setUpdatedTime(final Date updatedTime) {
149    this.updatedTime = updatedTime;
150  }
151}