001// Generated by delombok at Fri Oct 11 21:56:29 CEST 2019
002/**
003 * Copyright (c) 2010-2019 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  @Facebook
046  private Integer unread;
047  /**
048   * The amount of messages that are unseen by the session profile.
049   */
050  @Facebook
051  private Integer unseen;
052  /**
053   * The time of the last comment on this post.
054   */
055  @Facebook("updated_time")
056  private Date updatedTime;
057
058  /**
059   * The messages in this thread.
060   * 
061   * @return the messages in the thread
062   */
063  public List<Message> getComments() {
064    return unmodifiableList(comments);
065  }
066
067  public boolean addComment(Message comment) {
068    return comments.add(comment);
069  }
070
071  public boolean removeComment(Message comment) {
072    return comments.remove(comment);
073  }
074
075  /**
076   * A list of the Thread subscriber
077   * 
078   * @return A list of the thread subsscriber
079   */
080  public List<NamedFacebookType> getTo() {
081    return unmodifiableList(to);
082  }
083
084  public boolean addTo(NamedFacebookType subscriber) {
085    return to.add(subscriber);
086  }
087
088  public boolean removeTo(NamedFacebookType subscriber) {
089    return to.remove(subscriber);
090  }
091
092  /**
093   * The amount of messages that are unread by the session profile.
094   * 
095   * @return the amount of messages that are unread
096   */
097  @java.lang.SuppressWarnings("all")
098  public Integer getUnread() {
099    return this.unread;
100  }
101
102  /**
103   * The amount of messages that are unread by the session profile.
104   */
105  @java.lang.SuppressWarnings("all")
106  public void setUnread(final Integer unread) {
107    this.unread = unread;
108  }
109
110  /**
111   * The amount of messages that are unseen by the session profile.
112   * 
113   * @return the amount of messages that are unseen
114   */
115  @java.lang.SuppressWarnings("all")
116  public Integer getUnseen() {
117    return this.unseen;
118  }
119
120  /**
121   * The amount of messages that are unseen by the session profile.
122   */
123  @java.lang.SuppressWarnings("all")
124  public void setUnseen(final Integer unseen) {
125    this.unseen = unseen;
126  }
127
128  /**
129   * The time of the last comment on this post.
130   * 
131   * @return The time of the last comment on this post.
132   */
133  @java.lang.SuppressWarnings("all")
134  public Date getUpdatedTime() {
135    return this.updatedTime;
136  }
137
138  /**
139   * The time of the last comment on this post.
140   */
141  @java.lang.SuppressWarnings("all")
142  public void setUpdatedTime(final Date updatedTime) {
143    this.updatedTime = updatedTime;
144  }
145}