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.webhook.messaging;
024
025import com.restfb.Facebook;
026import com.restfb.types.send.IdMessageRecipient;
027import com.restfb.types.send.MessageRecipient;
028import com.restfb.types.send.UserRefMessageRecipient;
029
030public class MessagingParticipant {
031  @Facebook
032  private String id;
033  /**
034   * The user_ref of the user that triggered the webhook event.
035   *
036   * This is only available for webhook event from the chat plugin.
037   */
038  @Facebook("user_ref")
039  private String userRef;
040
041  public boolean isUserRef() {
042    return userRef != null;
043  }
044
045  public MessageRecipient toMessageRecipient() {
046    if (isUserRef()) {
047      return new UserRefMessageRecipient(userRef);
048    }
049    return new IdMessageRecipient(id);
050  }
051
052  @java.lang.Override
053  @java.lang.SuppressWarnings("all")
054  @lombok.Generated
055  public java.lang.String toString() {
056    return "MessagingParticipant(id=" + this.getId() + ", userRef=" + this.getUserRef() + ")";
057  }
058
059  @java.lang.SuppressWarnings("all")
060  @lombok.Generated
061  public String getId() {
062    return this.id;
063  }
064
065  @java.lang.SuppressWarnings("all")
066  @lombok.Generated
067  public void setId(final String id) {
068    this.id = id;
069  }
070
071  /**
072   * The user_ref of the user that triggered the webhook event.
073   *
074   * This is only available for webhook event from the chat plugin.
075   */
076  @java.lang.SuppressWarnings("all")
077  @lombok.Generated
078  public String getUserRef() {
079    return this.userRef;
080  }
081
082  /**
083   * The user_ref of the user that triggered the webhook event.
084   *
085   * This is only available for webhook event from the chat plugin.
086   */
087  @java.lang.SuppressWarnings("all")
088  @lombok.Generated
089  public void setUserRef(final String userRef) {
090    this.userRef = userRef;
091  }
092}