001/* 002 * Copyright 2024 Vonage 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.vonage.client.conversations; 017 018import com.fasterxml.jackson.annotation.JsonIgnore; 019import com.fasterxml.jackson.annotation.JsonProperty; 020import com.vonage.client.JsonableBaseObject; 021import com.vonage.client.users.BaseUser; 022 023/** 024 * Represents the basic conversation member attributes, as returned from {@link ListMembersResponse#getMembers()}. 025 */ 026public class BaseMember extends JsonableBaseObject { 027 @JsonProperty("id") String id; 028 @JsonProperty("state") MemberState state; 029 @JsonProperty("_embedded") Embedded _embedded; 030 @JsonProperty("user") BaseUser user; 031 032 protected BaseMember() {} 033 034 static final class Embedded extends JsonableBaseObject { 035 @JsonProperty("user") private BaseUser user; 036 } 037 038 /** 039 * Unique member identifier. 040 * 041 * @return The member ID, or {@code null} if unknown. 042 */ 043 public String getId() { 044 return id; 045 } 046 047 /** 048 * State that the member is in. 049 * 050 * @return The member state as an enum. 051 */ 052 public MemberState getState() { 053 return state; 054 } 055 056 /** 057 * User associated with this member. 058 * Full details can be obtained via {@link com.vonage.client.users.UsersClient#getUserDetails(BaseUser)}. 059 * 060 * @return The basic user details, or {@code null} if unknown. 061 */ 062 @JsonIgnore 063 public BaseUser getUser() { 064 return _embedded != null ? _embedded.user : user; 065 } 066}