public class Group {

	private final String privacy;
	private final String webUrl;
	private final GroupStats stats;
	private final String mugshotUrl;
	private final String url;
	private final String description;
	private final String fullName;
	private final String name;
	private final long id;
	private final Date createdAt;
	
	public Group(String privacy, String webUrl, GroupStats stats, String mugshotUrl, String url, String description,
			String fullName, String name, long id, Date createdAt) {
		this.privacy = privacy;
		this.webUrl = webUrl;
		this.stats = stats;
		this.mugshotUrl = mugshotUrl;
		this.url = url;
		this.description = description;
		this.fullName = fullName;
		this.name = name;
		this.id = id;
		this.createdAt = createdAt;
	}


	public String getPrivacy() {
		return privacy;
	}

	public String getWebUrl() {
		return webUrl;
	}

	public int getMemberCount(){
		return stats.members;
	}

	public int getUpdateCount(){
		return stats.updates;
	}
	public String getMugshotUrl() {
		return mugshotUrl;
	}

	public String getUrl() {
		return url;
	}

	public String getDescription() {
		return description;
	}

	public String getFullName() {
		return fullName;
	}

	public String getName() {
		return name;
	}

	public long getId() {
		return id;
	}

	public Date getCreatedAt() {
		return createdAt;
	}

    public Date getLastMessageAt(){
        return stats.lastMessageAt;
    }

	
	
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Group [privacy=").append(privacy).append(", webUrl=").append(webUrl)
				.append(", members=").append(getMemberCount()).append(", updates=").append(getUpdateCount())
				.append(", mugshotUrl=").append(mugshotUrl).append(", url=").append(url)
				.append(", description=").append(description).append(", fullName=").append(fullName).append(", name=")
				.append(name).append(", id=").append(id).append(", createdAt=").append(createdAt).append("]");
		return builder.toString();
	}



	public static class GroupStats{
		private final int updates;
		private final int members;
        private final Date lastMessageAt;
        private final long lastMessageId;

		public GroupStats(int updates, int members, Date lastMessageAt, long lastMessageId) {
			this.updates = updates;
			this.members = members;
            this.lastMessageAt = lastMessageAt;
            this.lastMessageId = lastMessageId;
        }
    }
} public static class GroupStats{
	private final int updates;
	private final int members;
       private final Date lastMessageAt;
       private final long lastMessageId;

	public GroupStats(int updates, int members, Date lastMessageAt, long lastMessageId) {
		this.updates = updates;
		this.members = members;
           this.lastMessageAt = lastMessageAt;
           this.lastMessageId = lastMessageId;
       }
   } public class GroupReference extends YammerReference{

	private String name;
	private String fullName;
	private String description;
	private String mugshotUrl;
	
	
	public GroupReference(long id, String url, String webUrl, String name) {
		super(id, url, webUrl);
		this.name= name;
	}
	
	/**
	 * @return the name of the group
	 */
	public String getName() {
		return name;
	}

	/**
	 * 
	 * @return the description of this group
	 */
	public String getDescription() {
		return description;
	}
	
	/**
	 * 
	 * @return the full name of this group
	 */
	public String getFullName() {
		return fullName;
	}
	
	public String getMugshotUrl() {
		return mugshotUrl;
	}

	@Override
	public String toString() {
		return "GroupReference [getId()=" + getId() + ", getUrl()=" + getUrl() + ", getWebUrl()=" + getWebUrl() + ", name=" + name
				+ ", fullName=" + fullName + ", description=" + description + ", mugshotUrl=" + mugshotUrl + "]";
	}
	
} public class MessageInfo {

	private List<YammerMessage> messages;
	private YammerMessageMeta metadata;
	private List<YammerReference> references;
	
	public MessageInfo(List<YammerMessage> messages, YammerMessageMeta meta, List<YammerReference> references) {
		this.messages=messages;
		this.metadata=meta;
		this.references=references;
	}
	
	/**
	 * List of messages
	 * @return <code>List</code> of {@link YammerMessage}s
	 */
	public List<YammerMessage> getMessages() {
		return messages;
	}
	
	/**
	 * Getter for the meta data for the message poll. Describes the meta data for the messages returned from {@link #getMessages()}
	 * @return {@link YammerMessageMeta}
	 */
	public YammerMessageMeta getMetadata() {
		return metadata;
	}
	
	/**
	 * Returns a list of references. The messages will link to references in this list
	 * @return list of references
	 * @see YammerReference
	 */
	public List<YammerReference> getReferences() {
		return references;
	}
	
} public class MessageReference extends YammerReference{

	public MessageReference(long id, String url, String webUrl) {
		super(id, url, webUrl);
	}
	
	

} public class SearchResults {

	private MessageInfo messages;
	private List<YammerProfile> users;
	private List<Group> groups;
	private SearchStats stats;
	private List<Topic> topics;
	
	public SearchResults(MessageInfo messages, List<YammerProfile> users, List<Group> groups, SearchStats searchStats, List<Topic> topics) {
		this.messages = messages;
		this.users = users;
		this.groups = groups;
		this.stats=searchStats;
		this.topics=topics;
	}

	public MessageInfo getMessages() {
		return messages;
	}

	public List<YammerProfile> getUsers() {
		return users;
	}

	public List<Group> getGroups() {
		return groups;
	}
	
	public List<Topic> getTopics() {
		return topics;
	}
	
	public int getUserCount(){
		return stats.userCount;
	}
	public int getGroupCount(){
		return stats.groupCount;
	}
	public int getMessageCount(){
		return stats.messageCount;
	}
	public int getTopicCount(){
		return stats.topicCount;
	}
	
	
	
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("SearchResults [messages=").append(messages).append(", users=").append(users)
				.append(", groups=").append(groups).append(", stats=").append(stats).append(", topics=").append(topics)
				.append("]");
		return builder.toString();
	}



	public static class SearchStats{
		private int groupCount;
		private int messageCount;
		private int topicCount;
		private int userCount;
		public SearchStats(int groupCount, int messageCount, int topicCount, int userCount) {
			this.groupCount = groupCount;
			this.messageCount = messageCount;
			this.topicCount = topicCount;
			this.userCount = userCount;
		}
		@Override
		public String toString() {
			StringBuilder builder = new StringBuilder();
			builder.append("SearchStats [groupCount=").append(groupCount).append(", messageCount=")
					.append(messageCount).append(", topicCount=").append(topicCount).append(", userCount=")
					.append(userCount).append("]");
			return builder.toString();
		}
		
	}
	
	
} public static class SearchStats{
	private int groupCount;
	private int messageCount;
	private int topicCount;
	private int userCount;
	public SearchStats(int groupCount, int messageCount, int topicCount, int userCount) {
		this.groupCount = groupCount;
		this.messageCount = messageCount;
		this.topicCount = topicCount;
		this.userCount = userCount;
	}
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("SearchStats [groupCount=").append(groupCount).append(", messageCount=")
				.append(messageCount).append(", topicCount=").append(topicCount).append(", userCount=")
				.append(userCount).append("]");
		return builder.toString();
	}
		
} public class TagReference extends YammerReference{

	private String name;
	
	public TagReference(long id, String url, String webUrl, String name) {
		super(id, url, webUrl);
		this.name = name;
	}
	
	public String getName() {
		return name;
	}
	

} public class ThreadReference extends YammerReference{

	private long threadStarterId;
	private ThreadStats stats;
	private boolean directMessage;
	
	public ThreadReference(long id, String url, String webUrl) {
		super(id, url, webUrl);
	}
	
	public long getThreadStarterId() {
		return threadStarterId;
	}
	
	public ThreadStats getStats() {
		return stats;
	}
	
	public boolean isDirectMessage() {
		return directMessage;
	}

	@Override
	public String toString() {
		return "ThreadReference [getId()=" + getId() + ", getUrl()=" + getUrl() + ", getWebUrl()=" + getWebUrl() + ", threadStarterId="
				+ threadStarterId + ", stats=" + stats + ", directMessage=" + directMessage + "]";
	}
	
	

} public class Topic {

	private String type;
	private String webUrl;
	private String normalizedName;
	private List<TopicExpert> experts;
	private String name;
	private long id;
	
	public Topic(String type, String webUrl, String normalizedName, List<TopicExpert> experts, String name, long id) {
		this.type = type;
		this.webUrl = webUrl;
		this.normalizedName = normalizedName;
		this.experts = experts;
		this.name = name;
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public String getWebUrl() {
		return webUrl;
	}

	public String getNormalizedName() {
		return normalizedName;
	}

	public List<TopicExpert> getExperts() {
		return experts;
	}

	public String getName() {
		return name;
	}

	public long getId() {
		return id;
	}

	public static class TopicExpert {
		private String type;
		private long id;

		public TopicExpert(String type, long id) {
			this.type = type;
			this.id = id;
		}
		public String getType() {
			return type;
		}
		public long getId() {
			return id;
		}
	
	}
} public static class TopicExpert {
	private String type;
	private long id;

	public TopicExpert(String type, long id) {
		this.type = type;
		this.id = id;
	}
	public String getType() {
		return type;
	}
	public long getId() {
		return id;
	}
	
} public class TopicReference extends YammerReference{

	private String name;
	private String normalizedName;
	private String permalink;
	
	public TopicReference(long id, String url, String webUrl, String name) {
		super(id, url, webUrl);
		this.name = name;
	}
	
	public String getName() {
		return name;
	}
	
	public String getNormalizedName() {
		return normalizedName;
	}
	
	public String getPermalink() {
		return permalink;
	}
	
	

} public class UserReference extends YammerReference{

	private String mugshotUrl;
	private YammerProfile.Stats userStats;
	private String fullName;
	private String title;
	private String name;
	
	
	public UserReference(long id, String url, String webUrl, String name) {
		super(id, url, webUrl);
		this.name=name;
	}

	public String getMugshotUrl() {
		return mugshotUrl;
	}

	public YammerProfile.Stats getUserStats() {
		return userStats;
	}

	public String getFullName() {
		return fullName;
	}


	public String getTitle() {
		return title;
	}


	public String getName() {
		return name;
	}


	@Override
	public String toString() {
		return "UserReference [getId()=" + getId() + ", getUrl()=" + getUrl() + ", getWebUrl()=" + getWebUrl() + ", mugshotUrl="
				+ mugshotUrl + ", userStats=" + userStats + ", fullName=" + fullName + ", title=" + title + ", name=" + name + "]";
	}
	
} public class YammerMessage {

	private long id;
	private String url;
	private long networkId;
	private String privacy;
	private long threadId;
	private String senderType;
	private List<Attachment> attachments;
	private Long repliedToId;
	private long senderId;
	private String webUrl;
	private String clientUrl;
	private boolean systemMessage;
	private String messageType;
	private Date createdAt;
	private boolean directMessage;
	private String clientType;
	private Body body;
	private LikedBy likedBy;
	private long groupId;
    private long sharedMessageId;


    public YammerMessage(long id, Body body, String url, long networkId, String privacy, long threadId,
			String senderType, List<Attachment> attachments, Long repliedToId, long senderId, String webUrl,
			String clientUrl, boolean systemMessage, String messageType, Date createdAt, boolean directMessage,
			String clientType, LikedBy likedBy, long groupId, long sharedMessageId) {
		super();
		this.id = id;
		this.body = body;
		this.url = url;
		this.networkId = networkId;
		this.privacy = privacy;
		this.threadId = threadId;
		this.senderType = senderType;
		this.attachments = attachments;
		this.repliedToId = repliedToId;
		this.senderId = senderId;
		this.webUrl = webUrl;
		this.clientUrl = clientUrl;
		this.systemMessage = systemMessage;
		this.messageType = messageType;
		this.createdAt = createdAt;
		this.directMessage = directMessage;
		this.clientType = clientType;
		this.likedBy = likedBy;
        this.groupId = groupId;
        this.sharedMessageId = sharedMessageId;
	}
    
    
    /**
     * The unique identifier for the message
     * @return message id
     */
	public long getId() {
		return id;
	}

	/**
	 * The restful URL of for this single message
	 * @return url
	 */
	public String getUrl() {
		return url;
	}

	/**
	 * The id of the network this message is posted to
	 * @return network id
	 */
	public long getNetworkId() {
		return networkId;
	}

	/**
	 * Privacy status of this message, either public or private
	 * @return private or public as String
	 */
	public String getPrivacy() {
		return privacy;
	}

	/**
	 * The id for the thread this message is a part of
	 * @return id of thread
	 */
	public long getThreadId() {
		return threadId;
	}

	public String getSenderType() {
		return senderType;
	}

	/**
	 * The list of attachments, if any
	 * @return attachments
	 */
	public List<Attachment> getAttachments() {
		return attachments;
	}

	/**
	 * The id of the message this message is a reply to, if any
	 * @return id of message this is a reply to, or <code>null</code> if this is not a reply
	 */
	public Long getRepliedToId() {
		return repliedToId;
	}

	public long getSenderId() {
		return senderId;
	}

	public String getWebUrl() {
		return webUrl;
	}

	public String getClientUrl() {
		return clientUrl;
	}

	public boolean isSystemMessage() {
		return systemMessage;
	}

	public String getMessageType() {
		return messageType;
	}

	public Date getCreatedAt() {
		return createdAt;
	}

	public boolean isDirectMessage() {
		return directMessage;
	}

	public String getClientType() {
		return clientType;
	}

	/**
	 * The body (text) of the yammer message
	 * @return body
	 */
	public Body getBody() {
		return body;
	}

	public LikedBy getLikedBy() {
		return likedBy;
	}
	
	public long getGroupId() {
		return groupId;
	}

    public long getSharedMessageId() {
        return sharedMessageId;
    }

    /**
	 * Holds the text of a message in different formats 
	 *
	 */
	public static class Body{
    	private String plain;
    	private String parsed;
    	private String rich;
    	private List<String> urls;
    	
		public Body(String plain, String parsed, String rich, List<String> urls) {
			super();
			this.plain = plain;
			this.parsed = parsed;
			this.rich=rich;
			this.urls = urls;
		}

		public String getPlain() {
			return plain;
		}

		public String getParsed() {
			return parsed;
		}

		public String getRich() {
			return rich;
		}
		
		public List<String> getUrls() {
			return urls;
		}
		
		@Override
		public String toString() {
			return plain;
		}
    }
    
    public static class LikedBy{
    	private int count;
    	private List<Name> names;
    	
    	public LikedBy(int count, List<Name> names) {
			super();
			this.count = count;
			this.names = names;
		}

    	/**
    	 * 
    	 * @return number of people who have 'liked' a message
    	 */
		public int getCount() {
			return count;
		}
		
		/**
		 * @return the names of people who liked the message
		 */
		public List<Name> getNames() {
			return names;
		}

		public static class Name{
    		private String permalink;
    		private String fullName;
            private long userId;
			
    		public Name(String permalink, String fullName, long userId) {
				super();
				this.permalink = permalink;
				this.fullName = fullName;
                this.userId = userId;
			}

			public String getFullName() {
				return fullName;
			}
    		
    		/**
			 * @return the yammer username that can be used in mentions (@)
			 */
			public String getPermalink() {
				return permalink;
			}

            /**
             * @return the user userId for the yammer user associated with the name
             * @see org.springframework.social.yammer.api.YammerProfile#getId()
             */
            public long getUserId() {
                return userId;
            }
        }
    }
	
    public static class Attachment{
    	private String uuid;
    	private String type;
    	private String contentType;
    	private String path;
    	private long yId;
    	private String size;
    	private String name;
    	private String webUrl;
    	private long id;
    	private String inlineUrl;
    	private String inlineHtml;
    	private File file;
    	private Image image;
    	
    	public Attachment(String uuid, String type, String contentType, String path, long yId, String size,
				String name, String webUrl, long id, String inlineUrl, String inlineHtml, File file, Image image) {
			this.uuid = uuid;
			this.type = type;
			this.contentType = contentType;
			this.path = path;
			this.yId = yId;
			this.size = size;
			this.name = name;
			this.webUrl = webUrl;
			this.id = id;
			this.inlineUrl = inlineUrl;
			this.inlineHtml = inlineHtml;
			this.file = file;
			this.image = image;
		}
    	
		public String getUuid() {
			return uuid;
		}

		public String getType() {
			return type;
		}

		public String getContentType() {
			return contentType;
		}

		public String getPath() {
			return path;
		}

		public long getyId() {
			return yId;
		}

		public String getSize() {
			return size;
		}

		public String getName() {
			return name;
		}

		public String getWebUrl() {
			return webUrl;
		}

		public long getId() {
			return id;
		}

		public String getInlineUrl() {
			return inlineUrl;
		}

		public String getInlineHtml() {
			return inlineHtml;
		}

		public File getFile() {
			return file;
		}

		public Image getImage() {
			return image;
		}
		
		public static class File{
    		private String url;
    		private long size;
			
    		public File(String url, long size) {
				this.url = url;
				this.size = size;
			}
    		
			public String getUrl() {
				return url;
			}

			public long getSize() {
				return size;
			}
    	}
    	
    	public static class Image{
    		private String url;
    		private long size;
    		private String thumbnailUrl;
			
    		public Image(String url, long size, String thumbnailUrl) {
				this.url = url;
				this.size = size;
				this.thumbnailUrl = thumbnailUrl;
			}

			public String getUrl() {
				return url;
			}

			public long getSize() {
				return size;
			}

			public String getThumbnailUrl() {
				return thumbnailUrl;
			}
    	}
    	
	}
}    public static class Attachment{
   	private String uuid;
   	private String type;
   	private String contentType;
   	private String path;
   	private long yId;
   	private String size;
   	private String name;
   	private String webUrl;
   	private long id;
   	private String inlineUrl;
   	private String inlineHtml;
   	private File file;
   	private Image image;
    	
   	public Attachment(String uuid, String type, String contentType, String path, long yId, String size,
			String name, String webUrl, long id, String inlineUrl, String inlineHtml, File file, Image image) {
		this.uuid = uuid;
		this.type = type;
		this.contentType = contentType;
		this.path = path;
		this.yId = yId;
		this.size = size;
		this.name = name;
		this.webUrl = webUrl;
		this.id = id;
		this.inlineUrl = inlineUrl;
		this.inlineHtml = inlineHtml;
		this.file = file;
		this.image = image;
	}
    	
	public String getUuid() {
		return uuid;
	}

	public String getType() {
		return type;
	}

	public String getContentType() {
		return contentType;
	}

	public String getPath() {
		return path;
	}

	public long getyId() {
		return yId;
	}

	public String getSize() {
		return size;
	}

	public String getName() {
		return name;
	}

	public String getWebUrl() {
		return webUrl;
	}

	public long getId() {
		return id;
	}

	public String getInlineUrl() {
		return inlineUrl;
	}

	public String getInlineHtml() {
		return inlineHtml;
	}

	public File getFile() {
		return file;
	}

	public Image getImage() {
		return image;
	}
		
	public static class File{
   		private String url;
   		private long size;
			
   		public File(String url, long size) {
			this.url = url;
			this.size = size;
		}
    		
		public String getUrl() {
			return url;
		}

		public long getSize() {
			return size;
		}
   	}
    	
   	public static class Image{
   		private String url;
   		private long size;
   		private String thumbnailUrl;
			
   		public Image(String url, long size, String thumbnailUrl) {
			this.url = url;
			this.size = size;
			this.thumbnailUrl = thumbnailUrl;
		}

		public String getUrl() {
			return url;
		}

		public long getSize() {
			return size;
		}

		public String getThumbnailUrl() {
			return thumbnailUrl;
		}
   	}
    	
} public static class File{
  		private String url;
  		private long size;
			
  		public File(String url, long size) {
		this.url = url;
		this.size = size;
	}
    		
	public String getUrl() {
		return url;
	}

	public long getSize() {
		return size;
	}
  	}  	public static class Image{
 		private String url;
 		private long size;
 		private String thumbnailUrl;
			
 		public Image(String url, long size, String thumbnailUrl) {
	this.url = url;
	this.size = size;
	this.thumbnailUrl = thumbnailUrl;
}

public String getUrl() {
	return url;
}

public long getSize() {
	return size;
}

public String getThumbnailUrl() {
	return thumbnailUrl;
}
 	} public static class Body{
   	private String plain;
   	private String parsed;
   	private String rich;
   	private List<String> urls;
    	
	public Body(String plain, String parsed, String rich, List<String> urls) {
		super();
		this.plain = plain;
		this.parsed = parsed;
		this.rich=rich;
		this.urls = urls;
	}

	public String getPlain() {
		return plain;
	}

	public String getParsed() {
		return parsed;
	}

	public String getRich() {
		return rich;
	}
		
	public List<String> getUrls() {
		return urls;
	}
		
	@Override
	public String toString() {
		return plain;
	}
   }   public static class LikedBy{
  	private int count;
  	private List<Name> names;
    	
  	public LikedBy(int count, List<Name> names) {
	super();
	this.count = count;
	this.names = names;
}

  	/**
  	 * 
  	 * @return number of people who have 'liked' a message
  	 */
public int getCount() {
	return count;
}
		
/**
 * @return the names of people who liked the message
 */
public List<Name> getNames() {
	return names;
}

public static class Name{
  		private String permalink;
  		private String fullName;
          private long userId;
			
  		public Name(String permalink, String fullName, long userId) {
		super();
		this.permalink = permalink;
		this.fullName = fullName;
              this.userId = userId;
	}

	public String getFullName() {
		return fullName;
	}
    		
  		/**
	 * @return the yammer username that can be used in mentions (@)
	 */
	public String getPermalink() {
		return permalink;
	}

          /**
           * @return the user userId for the yammer user associated with the name
           * @see org.springframework.social.yammer.api.YammerProfile#getId()
           */
          public long getUserId() {
              return userId;
          }
      }
  } public static class Name{
  		private String permalink;
  		private String fullName;
          private long userId;
			
  		public Name(String permalink, String fullName, long userId) {
		super();
		this.permalink = permalink;
		this.fullName = fullName;
              this.userId = userId;
	}

	public String getFullName() {
		return fullName;
	}
    		
  		/**
	 * @return the yammer username that can be used in mentions (@)
	 */
	public String getPermalink() {
		return permalink;
	}

          /**
           * @return the user userId for the yammer user associated with the name
           * @see org.springframework.social.yammer.api.YammerProfile#getId()
           */
          public long getUserId() {
              return userId;
          }
      } public class YammerMessageMeta {

	private long currentUserId;
	private String feedName;
	private String feedDescription;
	private int unseenMessageCountFollowing;
	private int unseenMessageCountReceived;
	private List<Long> likedMessageIds;
	private List<Long> favoriteMessageIds;
	private List<Long> followedUserIds;
	private List<Long> bookmarkedMessageIds;
	
	public YammerMessageMeta(long currentUserId, String feedName, String feedDescription,
			int unseenMessageCountFollowing, int unseenMessageCountReceived, List<Long> likedMessageIds,
			List<Long> favoriteMessageIds, List<Long> followedUserIds, List<Long> bookmarkedMessageIds) {
		this.currentUserId = currentUserId;
		this.feedName = feedName;
		this.feedDescription = feedDescription;
		this.unseenMessageCountFollowing = unseenMessageCountFollowing;
		this.unseenMessageCountReceived = unseenMessageCountReceived;
		this.likedMessageIds = likedMessageIds;
		this.favoriteMessageIds = favoriteMessageIds;
		this.followedUserIds = followedUserIds;
		this.bookmarkedMessageIds = bookmarkedMessageIds;
	}

	public long getCurrentUserId() {
		return currentUserId;
	}

	public String getFeedName() {
		return feedName;
	}

	public String getFeedDescription() {
		return feedDescription;
	}

	public int getUnseenMessageCountFollowing() {
		return unseenMessageCountFollowing;
	}

	public int getUnseenMessageCountReceived() {
		return unseenMessageCountReceived;
	}

	public List<Long> getLikedMessageIds() {
		return likedMessageIds;
	}

	public List<Long> getFavoriteMessageIds() {
		return favoriteMessageIds;
	}

	public List<Long> getFollowedUserIds() {
		return followedUserIds;
	}

	public List<Long> getBookmarkedMessageIds() {
		return bookmarkedMessageIds;
	}
	
	
	
	
	
	
} public class YammerProfile {

	private long id;
	private String mugshotUrl;
	private Stats stats;
	private String type;
	private String url;
	private String fullName;
	private String name;
	private boolean admin;
	private String expertise;
	private String summary;
	private List<School> schools;
	private List<String> externalUrls;
	private String jobTitle;
	private Contact contact;
	
	private String lastName;
	private String firstName;
	private long networkId;
	private String timezone;
	
	public YammerProfile(long id, 
			String mugshotUrl, 
			Stats stats, 
			String type, 
			String url, 
			String fullName,
			String name, 
			boolean admin, 
			String expertise, 
			String summary, 
			String jobTitle, 
			Contact contact, 
			List<School> schools, 
			List<String> externalUrls,
			
			String lastName,
			String firstName,
			long networkId,
			String timezone
			) {
		super();
		this.id = id;
		this.mugshotUrl = mugshotUrl;
		this.stats = stats;
		this.type = type;
		this.url = url;
		this.fullName = fullName;
		this.name = name;
		this.admin = admin;
		this.expertise = expertise;
		this.summary = summary;
		this.jobTitle = jobTitle;
		this.contact = contact;
		this.schools = schools;
		this.externalUrls = externalUrls;
		this.lastName = lastName;
		this.firstName = firstName;
		this.networkId = networkId;
		this.timezone = timezone;
		
		

	}
	
	/**
	 * @return the contact
	 */
	public Contact getContact() {
		return contact;
	}
	
	/**
	 * @return the schools
	 */
	public List<School> getSchools() {
		return schools;
	}

	public String getMugshotUrl() {
		return mugshotUrl;
	}
	
	public void setMugshotUrl(String mugshotUrl) {
		this.mugshotUrl = mugshotUrl;
	}
	
	public long getFollowersCount(){
		return stats.followers;
	}
	
	public long getFollowingCount(){
		return stats.following;
	}
	
	public long getMessageCount(){
		return stats.updates;
	}
	
	public long getId() {
		return id;
	}

	public String getType() {
		return type;
	}

	public String getUrl() {
		return url;
	}

	public String getFullName() {
		return fullName;
	}


	public String getName() {
		return name;
	}

	public boolean isAdmin() {
		return admin;
	}

	public String getExpertise() {
		return expertise;
	}

	public String getSummary() {
		return summary;
	}

	public List<String> getExternalUrls() {
		return externalUrls;
	}

	public void setJobTitle(String jobTitle) {
		this.jobTitle = jobTitle;
	}

	public String getJobTitle() {
		return jobTitle;
	}
	
	
	

	public String getLastName() {
		return lastName;
	}

	public String getFirstName() {
		return firstName;
	}

	public long getNetworkId() {
		return networkId;
	}

	public String getTimezone() {
		return timezone;
	}




	public static class Contact{
		private List<EMail> eMails;
		private List<Phone> phoneNumbers;
		private InstantMessaging instantMessaging;
		
		public Contact(List<EMail> eMails, List<Phone> phoneNumbers, InstantMessaging instantMessaging) {
			this.eMails = eMails;
			this.phoneNumbers = phoneNumbers;
			this.instantMessaging = instantMessaging;
		}
		
		public List<EMail> getEMailAdresses() {
			return eMails;
		}
		
		public InstantMessaging getInstantMessaging() {
			return instantMessaging;
		}
		
		public List<Phone> getPhoneNumbers() {
			return phoneNumbers;
		}

		
		
	}
	
	public static class EMail{
		private String type;
		private String address;
		
		public EMail(String address, String type){
			this.type = type;
			this.address = address;
		}

		public String getAddress() {
			return address;
		}

		public String getType() {
			return type;
		}
		
		public String toString() {
			return this.address + " " + this.type;
		}
	}
	
	public static class Phone{
		private String type;
		private String number;
	
		
		public Phone(String number, String type){
			this.type = type;
			this.number = number;
		}

		public String getNumber() {
			return number;
		}

		public String getType() {
			return type;
		}
		
		public String toString() {
			return this.number + " " + this.type;
		}
	}
	
	public static class InstantMessaging{
		private String provider;
		private String username;

		public InstantMessaging(String provider, String username) {
			this.provider = provider;
			this.username = username;
		}

		public String getProvider() {
			return provider;
		}
		
		public String getUsername() {
			return username;
		}
		
	}	
	
	public static class School {
		private String degree;
		private String name;
		private String description;
		private int startYear;
		private int endYear;
		
		public School(String name, String degree, String description, int startYear, int endYear) {
			super();
			this.name = name;
			this.degree = degree;
			this.description = description;
			this.startYear = startYear;
			this.endYear = endYear;
		}
		
		
		public String getDegree() {
			return degree;
		}
		public String getName() {
			return name;
		}
		public String getDescription() {
			return description;
		}
		public int getStartYear() {
			return startYear;
		}
		public int getEndYear() {
			return endYear;
		}
		
	}
	
	public static class Stats {
		private long followers;
		private long following;
		private long updates;
		
		public Stats(long followers, long following, long updates) {
			super();
			this.followers = followers;
			this.following = following;
			this.updates = updates;
		}

		public long getFollowers() {
			return followers;
		}

		public long getFollowing() {
			return following;
		}

		public long getUpdates() {
			return updates;
		}

		@Override
		public String toString() {
			return "Stats [followers=" + followers + ", following=" + following + ", updates=" + updates + "]";
		}

	}
	
} public static class Contact{
	private List<EMail> eMails;
	private List<Phone> phoneNumbers;
	private InstantMessaging instantMessaging;
		
	public Contact(List<EMail> eMails, List<Phone> phoneNumbers, InstantMessaging instantMessaging) {
		this.eMails = eMails;
		this.phoneNumbers = phoneNumbers;
		this.instantMessaging = instantMessaging;
	}
		
	public List<EMail> getEMailAdresses() {
		return eMails;
	}
		
	public InstantMessaging getInstantMessaging() {
		return instantMessaging;
	}
		
	public List<Phone> getPhoneNumbers() {
		return phoneNumbers;
	}

		
		
} public static class EMail{
	private String type;
	private String address;
		
	public EMail(String address, String type){
		this.type = type;
		this.address = address;
	}

	public String getAddress() {
		return address;
	}

	public String getType() {
		return type;
	}
		
	public String toString() {
		return this.address + " " + this.type;
	}
} public static class InstantMessaging{
	private String provider;
	private String username;

	public InstantMessaging(String provider, String username) {
		this.provider = provider;
		this.username = username;
	}

	public String getProvider() {
		return provider;
	}
		
	public String getUsername() {
		return username;
	}
		
}	 public static class Phone{
	private String type;
	private String number;
	
		
	public Phone(String number, String type){
		this.type = type;
		this.number = number;
	}

	public String getNumber() {
		return number;
	}

	public String getType() {
		return type;
	}
		
	public String toString() {
		return this.number + " " + this.type;
	}
} public static class School {
	private String degree;
	private String name;
	private String description;
	private int startYear;
	private int endYear;
		
	public School(String name, String degree, String description, int startYear, int endYear) {
		super();
		this.name = name;
		this.degree = degree;
		this.description = description;
		this.startYear = startYear;
		this.endYear = endYear;
	}
		
		
	public String getDegree() {
		return degree;
	}
	public String getName() {
		return name;
	}
	public String getDescription() {
		return description;
	}
	public int getStartYear() {
		return startYear;
	}
	public int getEndYear() {
		return endYear;
	}
		
} public static class Stats {
	private long followers;
	private long following;
	private long updates;
		
	public Stats(long followers, long following, long updates) {
		super();
		this.followers = followers;
		this.following = following;
		this.updates = updates;
	}

	public long getFollowers() {
		return followers;
	}

	public long getFollowing() {
		return following;
	}

	public long getUpdates() {
		return updates;
	}

	@Override
	public String toString() {
		return "Stats [followers=" + followers + ", following=" + following + ", updates=" + updates + "]";
	}

} public class YammerReference {
	
	// Shared properties for all references
	private long id;
	private String url;
	private String webUrl;
	
	public YammerReference(long id, String url, String webUrl) {
		super();
		this.id = id;
		this.url = url;
		this.webUrl = webUrl;
	}
	
	public long getId() {
		return id;
	}
	
	public String getUrl() {
		return url;
	}
	
	public String getWebUrl() {
		return webUrl;
	}

	@Override
	public String toString() {
		return "YammerReference [id=" + id + ", url=" + url + ", webUrl=" + webUrl + "]";
	}

} public class YammerThread {

	private ThreadStats stats;
	private String type;
	private String privacy;
	private long threadStarterId;
	private boolean hasAttachements;
	private String webUrl;
	private long id;
	private boolean directMessage;
	private List<Topic> topics;
	
	public YammerThread(
			ThreadStats stats, String type, String privacy, long threadStarterId, boolean hasAttachements,
			String webUrl, long id, boolean directMessage, List<Topic> topics) {
		this.stats = stats;
		this.type = type;
		this.privacy = privacy;
		this.threadStarterId = threadStarterId;
		this.hasAttachements = hasAttachements;
		this.webUrl = webUrl;
		this.id = id;
		this.directMessage = directMessage;
		this.topics = topics;
	}
	

	public long getFirstReplyId(){
		return stats.firstReplyId;
	}
	
	public Date getFirstReplyDate(){
		return stats.firstReplyAt;
	}
	
	public long getLatestReplyId(){
		return stats.latestReplyId;
	}
	
	public Date getLatestReplyDate(){
		return stats.latestReplyAt;
	}
	
	public int getMessageCount(){
		return stats.messageCount;
	}

	public String getType() {
		return type;
	}

	public String getPrivacy() {
		return privacy;
	}

	public long getThreadStarterId() {
		return threadStarterId;
	}

	public boolean hasAttachements() {
		return hasAttachements;
	}


	public String getWebUrl() {
		return webUrl;
	}


	public long getId() {
		return id;
	}


	public boolean isDirectMessage() {
		return directMessage;
	}

	public List<Topic> getTopics() {
		return topics;
	}


	public static class ThreadStats{
		private Date firstReplyAt;
		private Date latestReplyAt;
		private long firstReplyId;
		private long latestReplyId;
		private int messageCount;
        private int shares;
		
		
		public ThreadStats(Date firstReplyAt, Date latestReplyAt, long firstReplyId, long latestReplyId,
				int messageCount, int shares) {
			this.firstReplyAt = firstReplyAt;
			this.latestReplyAt = latestReplyAt;
			this.firstReplyId = firstReplyId;
			this.latestReplyId = latestReplyId;
			this.messageCount = messageCount;
            this.shares=shares;
		}


		@Override
		public String toString() {
			return "ThreadStats [firstReplyAt=" + firstReplyAt + ", latestReplyAt=" + latestReplyAt + ", firstReplyId=" + firstReplyId
					+ ", latestReplyId=" + latestReplyId + ", messageCount=" + messageCount + ", shares=" + shares + "]";
		}
		
		
		
	}
	
} public static class ThreadStats{
	private Date firstReplyAt;
	private Date latestReplyAt;
	private long firstReplyId;
	private long latestReplyId;
	private int messageCount;
       private int shares;
		
		
	public ThreadStats(Date firstReplyAt, Date latestReplyAt, long firstReplyId, long latestReplyId,
			int messageCount, int shares) {
		this.firstReplyAt = firstReplyAt;
		this.latestReplyAt = latestReplyAt;
		this.firstReplyId = firstReplyId;
		this.latestReplyId = latestReplyId;
		this.messageCount = messageCount;
           this.shares=shares;
	}


	@Override
	public String toString() {
		return "ThreadStats [firstReplyAt=" + firstReplyAt + ", latestReplyAt=" + latestReplyAt + ", firstReplyId=" + firstReplyId
				+ ", latestReplyId=" + latestReplyId + ", messageCount=" + messageCount + ", shares=" + shares + "]";
	}
		
		
		
}    @JsonIgnoreProperties(ignoreUnknown=true)
   static class GroupStatsMixin{
	@JsonCreator

	GroupStatsMixin(
			@JsonProperty("members") int members,
			@JsonProperty("updates") int updates,
			@JsonProperty("last_message_at") @JsonDeserialize(using=YammerDateDeserializer.class) Date lastMessageAt,
			@JsonProperty("last_message_id") long lastMessageId
	) {}
}    @JsonIgnoreProperties(ignoreUnknown=true)
static class SearchStatsMixin{
	@JsonCreator
	public SearchStatsMixin(
	  @JsonProperty("groups") int groups,
	  @JsonProperty("messages") int messages,
	  @JsonProperty("topics") int topics,
	  @JsonProperty("users") int users
	) {}
}    @JsonIgnoreProperties(ignoreUnknown=true)
static class TopicExpertMixin{

	@JsonCreator
	public TopicExpertMixin(
		@JsonProperty("type") String type,
		@JsonProperty("id") long id
	) {}
} @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class AttachmentMixin{
	@JsonCreator
	AttachmentMixin(
			@JsonProperty("uuid")String uuid, 
			@JsonProperty("type")String type, 
			@JsonProperty("content_type")String contentType, 
			@JsonProperty("path")String path, 
			@JsonProperty("y_id")long yId, 
			@JsonProperty("size")String size,
			@JsonProperty("name")String name, 
			@JsonProperty("web_url")String webUrl, 
			@JsonProperty("id")long id, 
			@JsonProperty("inline_url")String inlineUrl, 
			@JsonProperty("inline_html")String inlineHtml, 
			@JsonProperty("file")File file, 
			@JsonProperty("image")Image image
	) {}

       @JsonIgnoreProperties(ignoreUnknown=true)
	abstract static class FileMixin{
		@JsonCreator
		FileMixin(
	    	@JsonProperty("url") String url,
	    	@JsonProperty("size") long size
		) {}
	}

       @JsonIgnoreProperties(ignoreUnknown=true)
	abstract static class ImageMixin{
		@JsonCreator
		ImageMixin(
	    	@JsonProperty("url") String url,
	    	@JsonProperty("size")long size,
	    	@JsonProperty("thumbnail_url")String thumbnailUrl				
		){}
	}
}    @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class BodyMixin{
	@JsonCreator
	BodyMixin(
		@JsonProperty("plain")String plain,
		@JsonProperty("parsed")String formatted,
		@JsonProperty("rich")String rich,
		@JsonProperty("urls")List<String> urls
	){}
}    @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class LikedByMixin{
	@JsonCreator
	LikedByMixin(
		@JsonProperty("count")int count,
		@JsonProperty("names") List<Name> names
	){}

       @JsonIgnoreProperties(ignoreUnknown=true)
	abstract static class NameMixin{
		@JsonCreator
		NameMixin(
			@JsonProperty("permalink") String permalink,
			@JsonProperty("full_name") String fullname,
               @JsonProperty("user_id") long userId
		){}
	}
}       @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class FileMixin{
	@JsonCreator
	FileMixin(
    	@JsonProperty("url") String url,
    	@JsonProperty("size") long size
	) {}
}       @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class ImageMixin{
	@JsonCreator
	ImageMixin(
    	@JsonProperty("url") String url,
    	@JsonProperty("size")long size,
    	@JsonProperty("thumbnail_url")String thumbnailUrl				
	){}
}       @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class NameMixin{
	@JsonCreator
	NameMixin(
		@JsonProperty("permalink") String permalink,
		@JsonProperty("full_name") String fullname,
              @JsonProperty("user_id") long userId
	){}
} @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class ContactMixin {
	@JsonCreator
	ContactMixin(
			@JsonProperty("email_addresses") List<EMail> emailAddresses,
			@JsonProperty("phone_numbers") List<Phone> phoneNumbers,
			@JsonProperty("im") InstantMessaging instantMessaging
	){}
} @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class EMailMixin {
	@JsonCreator
	EMailMixin(
			@JsonProperty("address") String address,
			@JsonProperty("type") String type
	){}
} @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class InstantMessagingMixin {
	@JsonCreator
	InstantMessagingMixin(
			@JsonProperty("provider") String type,
			@JsonProperty("username") String address
	){}
} @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class PhoneMixin {
	@JsonCreator
	PhoneMixin(
			@JsonProperty("number") String number,
			@JsonProperty("type") String type
				
	){}
} @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class SchoolMixin {
		@JsonCreator
		SchoolMixin(
				@JsonProperty("school") String name, 
				@JsonProperty("degree") String degreee,
				@JsonProperty("description") String description, 
				@JsonProperty("start_year") int startYear, 
				@JsonProperty("end_year") int endYear 
		){}
} @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class StatsMixin {
	@JsonCreator
	StatsMixin(
			@JsonProperty("followers") long followers, 
			@JsonProperty("following") long following,
			@JsonProperty("updates") long updates 
	){}
}    @JsonIgnoreProperties(ignoreUnknown=true)
abstract static class YammerThreadStatsMixin{
		
	@JsonCreator
	public YammerThreadStatsMixin(
			@JsonProperty("first_reply_at") @JsonDeserialize(using=YammerDateDeserializer.class) Date firstReplyAt,
			@JsonProperty("latest_reply_at") @JsonDeserialize(using=YammerDateDeserializer.class) Date latestReplyAt,
			@JsonProperty("first_reply_id") long firstReplyId,
			@JsonProperty("latest_reply_id") long latestReplyId,
			@JsonProperty("updates") int messageCount,
               @JsonProperty("shares") int shares
	){}
		
}
import org.codehaus.jackson.Version;
import org.codehaus.jackson.map.module.SimpleModule;
import org.springframework.social.yammer.api.Group;
import org.springframework.social.yammer.api.Group.GroupStats;
import org.springframework.social.yammer.api.GroupReference;
import org.springframework.social.yammer.api.MessageInfo;
import org.springframework.social.yammer.api.MessageReference;
import org.springframework.social.yammer.api.SearchResults;
import org.springframework.social.yammer.api.SearchResults.SearchStats;
import org.springframework.social.yammer.api.TagReference;
import org.springframework.social.yammer.api.ThreadReference;
import org.springframework.social.yammer.api.Topic;
import org.springframework.social.yammer.api.Topic.TopicExpert;
import org.springframework.social.yammer.api.TopicReference;
import org.springframework.social.yammer.api.UserReference;
import org.springframework.social.yammer.api.YammerMessage;
import org.springframework.social.yammer.api.YammerMessage.Attachment;
import org.springframework.social.yammer.api.YammerMessage.Attachment.File;
import org.springframework.social.yammer.api.YammerMessage.Attachment.Image;
import org.springframework.social.yammer.api.YammerMessage.Body;
import org.springframework.social.yammer.api.YammerMessage.LikedBy;
import org.springframework.social.yammer.api.YammerMessage.LikedBy.Name;
import org.springframework.social.yammer.api.YammerMessageMeta;
import org.springframework.social.yammer.api.YammerProfile;
import org.springframework.social.yammer.api.YammerProfile.Contact;
import org.springframework.social.yammer.api.YammerProfile.EMail;
import org.springframework.social.yammer.api.YammerProfile.InstantMessaging;
import org.springframework.social.yammer.api.YammerProfile.Phone;
import org.springframework.social.yammer.api.YammerProfile.School;
import org.springframework.social.yammer.api.YammerProfile.Stats;
import org.springframework.social.yammer.api.YammerReference;
import org.springframework.social.yammer.api.YammerThread;
import org.springframework.social.yammer.api.YammerThread.ThreadStats;
import org.springframework.social.yammer.api.impl.json.GroupMixin.GroupStatsMixin;
import org.springframework.social.yammer.api.impl.json.SearchResultsMixin.SearchStatsMixin;
import org.springframework.social.yammer.api.impl.json.TopicMixin.TopicExpertMixin;
import org.springframework.social.yammer.api.impl.json.YammerMessageMixin.AttachmentMixin;
import org.springframework.social.yammer.api.impl.json.YammerMessageMixin.BodyMixin;
import org.springframework.social.yammer.api.impl.json.YammerMessageMixin.LikedByMixin;
import org.springframework.social.yammer.api.impl.json.YammerMessageMixin.AttachmentMixin.FileMixin;
import org.springframework.social.yammer.api.impl.json.YammerMessageMixin.AttachmentMixin.ImageMixin;
import org.springframework.social.yammer.api.impl.json.YammerMessageMixin.LikedByMixin.NameMixin;
import org.springframework.social.yammer.api.impl.json.YammerProfileMixin.ContactMixin;
import org.springframework.social.yammer.api.impl.json.YammerProfileMixin.EMailMixin;
import org.springframework.social.yammer.api.impl.json.YammerProfileMixin.InstantMessagingMixin;
import org.springframework.social.yammer.api.impl.json.YammerProfileMixin.PhoneMixin;
import org.springframework.social.yammer.api.impl.json.YammerProfileMixin.SchoolMixin;
import org.springframework.social.yammer.api.impl.json.YammerProfileMixin.StatsMixin;
import org.springframework.social.yammer.api.impl.json.YammerThreadMixin.YammerThreadStatsMixin;
/*
 * Copyright 2011 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.social.yammer.api.impl.json;


/**
 * @author Morten Andersen-Gott
 *
 */
public class YammerModule extends SimpleModule {

	public YammerModule() {
		super("YammerModule", new Version(1, 0, 0, null));
	}

	@Override
	public void setupModule(SetupContext context) {
		context.setMixInAnnotations(YammerMessageMeta.class, YammerMessageMetaMixin.class);
		context.setMixInAnnotations(YammerProfile.class, YammerProfileMixin.class);
		context.setMixInAnnotations(Stats.class, StatsMixin.class);
		context.setMixInAnnotations(Contact.class, ContactMixin.class);
		context.setMixInAnnotations(EMail.class, EMailMixin.class);
		context.setMixInAnnotations(Phone.class, PhoneMixin.class);
		context.setMixInAnnotations(InstantMessaging.class, InstantMessagingMixin.class);
		context.setMixInAnnotations(School.class, SchoolMixin.class);
		context.setMixInAnnotations(MessageInfo.class, MessageInfoMixin.class);
		context.setMixInAnnotations(YammerMessage.class, YammerMessageMixin.class);
		context.setMixInAnnotations(Body.class, BodyMixin.class);
		context.setMixInAnnotations(LikedBy.class, LikedByMixin.class);
		context.setMixInAnnotations(Attachment.class, AttachmentMixin.class);
		context.setMixInAnnotations(File.class, FileMixin.class);
		context.setMixInAnnotations(Image.class, ImageMixin.class);
		context.setMixInAnnotations(Name.class, NameMixin.class);
		context.setMixInAnnotations(Group.class, GroupMixin.class);
		context.setMixInAnnotations(GroupStats.class, GroupStatsMixin.class);
		context.setMixInAnnotations(Topic.class, TopicMixin.class);
		context.setMixInAnnotations(TopicExpert.class, TopicExpertMixin.class);
		context.setMixInAnnotations(SearchResults.class, SearchResultsMixin.class);
		context.setMixInAnnotations(SearchStats.class, SearchStatsMixin.class);