001// Generated by delombok at Thu Aug 13 13:56:44 UTC 2026
002/*
003 * Copyright (c) 2010-2026 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  @lombok.Generated
099  public Integer getUnread() {
100    return this.unread;
101  }
102
103  /**
104   * The amount of messages that are unread by the session profile.
105   */
106  @java.lang.SuppressWarnings("all")
107  @lombok.Generated
108  public void setUnread(final Integer unread) {
109    this.unread = unread;
110  }
111
112  /**
113   * The amount of messages that are unseen by the session profile.
114   *
115   * @return the amount of messages that are unseen
116   */
117  @java.lang.SuppressWarnings("all")
118  @lombok.Generated
119  public Integer getUnseen() {
120    return this.unseen;
121  }
122
123  /**
124   * The amount of messages that are unseen by the session profile.
125   */
126  @java.lang.SuppressWarnings("all")
127  @lombok.Generated
128  public void setUnseen(final Integer unseen) {
129    this.unseen = unseen;
130  }
131
132  /**
133   * The time of the last comment on this post.
134   *
135   * @return The time of the last comment on this post.
136   */
137  @java.lang.SuppressWarnings("all")
138  @lombok.Generated
139  public Date getUpdatedTime() {
140    return this.updatedTime;
141  }
142
143  /**
144   * The time of the last comment on this post.
145   */
146  @java.lang.SuppressWarnings("all")
147  @lombok.Generated
148  public void setUpdatedTime(final Date updatedTime) {
149    this.updatedTime = updatedTime;
150  }
151}