001// Generated by delombok at Wed Jan 31 21:27:42 UTC 2024
002/*
003 * Copyright (c) 2010-2024 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 com.restfb.util.DateUtils.toDateFromLongFormat;
026import static com.restfb.util.DateUtils.toDateFromShortFormat;
027import static java.util.Collections.unmodifiableList;
028import java.util.ArrayList;
029import java.util.Date;
030import java.util.List;
031import com.restfb.Facebook;
032import com.restfb.JsonMapper;
033import com.restfb.JsonMapper.JsonMappingCompleted;
034import com.restfb.annotation.GraphAPI;
035import com.restfb.types.features.HasCover;
036import com.restfb.types.features.HasProfilePicture;
037
038/**
039 * Represents the <a href="http://developers.facebook.com/docs/reference/api/event">Event Graph API type</a>.
040 * 
041 * @author <a href="http://restfb.com">Mark Allen</a>
042 * @since 1.5
043 */
044public class Event extends NamedFacebookType implements HasProfilePicture, HasCover {
045  /**
046   * The user who owns the event.
047   * 
048   */
049  @Facebook
050  private Owner owner;
051  /**
052   * The category of the event.
053   */
054  @Facebook
055  @GraphAPI(since = "2.4")
056  private String category;
057  /**
058   * Can guests invite friends.
059   */
060  @Facebook("can_guests_invite")
061  private Boolean canGuestsInvite;
062  /**
063   * Can see guest list.
064   */
065  @Facebook("guest_list_enabled")
066  private Boolean guestListEnabled;
067  /**
068   * The long-form HTML description of the event.
069   * 
070   */
071  @Facebook
072  private String description;
073  @Facebook("start_time")
074  private transient String rawStartTime;
075  @Facebook("end_time")
076  private transient String rawEndTime;
077  /**
078   * The start time of the event.
079   * 
080   */
081  private Date startTime;
082  /**
083   * The end time of the event.
084   * 
085   */
086  private Date endTime;
087  /**
088   * Whether or not the event has been marked as canceled
089   */
090  @Facebook("is_canceled")
091  private Boolean isCanceled;
092  /**
093   * The RSVP status of this event.
094   * 
095   */
096  @Facebook("rsvp_status")
097  private String rsvpStatus;
098  /**
099   * Number of people interested in the event.
100   */
101  @Facebook("interested_count")
102  @GraphAPI(since = "2.1")
103  private Long interestedCount;
104  /**
105   * Whether the event is created by page or not.
106   */
107  @Facebook("is_page_owned")
108  private Boolean isPageOwned;
109  /**
110   * The visibility of this event. Can be 'OPEN', 'CLOSED', or 'SECRET'.
111   * 
112   */
113  @Facebook
114  private String privacy;
115  /**
116   * The last time the event was updated.
117   * 
118   */
119  @Facebook("updated_time")
120  private Date updatedTime;
121  /**
122   * The URL to a location to buy tickets for this event (on Events for Pages only).
123   * 
124   * @since 1.6.13
125   */
126  @Facebook("ticket_uri")
127  private String ticketUri;
128  /**
129   * The event's picture.
130   * 
131   * @since 1.6.13
132   */
133  private ProfilePictureSource picture;
134  @Facebook("picture")
135  private transient String rawPicture;
136  /**
137   * The group the event belongs to, if any.
138   * 
139   */
140  @Facebook("parent_group")
141  private Group parentGroup;
142  /**
143   * Location associated with the event, if any.
144   */
145  @Facebook
146  @GraphAPI(since = "2.3")
147  private Place place;
148  /**
149   * Should the time information be ignored in the dates for this event?
150   * 
151   * @since 1.6.13
152   */
153  @Facebook("is_date_only")
154  private Boolean isDateOnly;
155  /**
156   * the timezone of the event
157   */
158  @Facebook
159  private String timezone;
160  /**
161   * Cover picture
162   */
163  @Facebook
164  private CoverPhoto cover;
165  /**
166   * Number of people attending the event
167   */
168  @Facebook("attending_count")
169  @GraphAPI(since = "2.1")
170  private Integer attendingCount;
171  /**
172   * Number of people who declined the event
173   */
174  @Facebook("declined_count")
175  @GraphAPI(since = "2.1")
176  private Integer declinedCount;
177  /**
178   * Number of people who maybe going to the event
179   */
180  @Facebook("maybe_count")
181  @GraphAPI(since = "2.1")
182  private Integer maybeCount;
183  /**
184   * Number of people who did not reply to the event
185   */
186  @Facebook("noreply_count")
187  @GraphAPI(since = "2.1")
188  private Integer noreplyCount;
189  private static final long serialVersionUID = 2L;
190
191
192  /**
193   * Represents the <a href="http://developers.facebook.com/docs/reference/api/event">Event Owner Graph API type</a>.
194   * 
195   * @author <a href="http://restfb.com">Mark Allen</a>
196   * @since 1.6.13
197   */
198  public static class Owner extends AbstractFacebookType {
199    /**
200     * The unique identifier for this owner.
201     * 
202     */
203    @Facebook
204    private String id;
205    /**
206     * The name of this owner.
207     * 
208     */
209    @Facebook
210    private String name;
211    /**
212     * The category for this owner.
213     * 
214     */
215    @Facebook
216    private String category;
217    @Facebook("category_list")
218    private List<Category> categoryList = new ArrayList<>();
219    private static final long serialVersionUID = 1L;
220
221    public boolean addCategory(Category category) {
222      return categoryList.add(category);
223    }
224
225    public boolean removeCategory(Category category) {
226      return categoryList.remove(category);
227    }
228
229    /**
230     * List of other categories for this owner.
231     * 
232     * @return List of other categories for this owner.
233     */
234    public List<Category> getCategoryList() {
235      return unmodifiableList(categoryList);
236    }
237
238    /**
239     * The unique identifier for this owner.
240     * 
241     * @return The unique identifier for this owner.
242     */
243    @java.lang.SuppressWarnings("all")
244    public String getId() {
245      return this.id;
246    }
247
248    /**
249     * The unique identifier for this owner.
250     * 
251     */
252    @java.lang.SuppressWarnings("all")
253    public void setId(final String id) {
254      this.id = id;
255    }
256
257    /**
258     * The name of this owner.
259     * 
260     * @return The name of this owner.
261     */
262    @java.lang.SuppressWarnings("all")
263    public String getName() {
264      return this.name;
265    }
266
267    /**
268     * The name of this owner.
269     * 
270     */
271    @java.lang.SuppressWarnings("all")
272    public void setName(final String name) {
273      this.name = name;
274    }
275
276    /**
277     * The category for this owner.
278     * 
279     * @return The category for this owner.
280     */
281    @java.lang.SuppressWarnings("all")
282    public String getCategory() {
283      return this.category;
284    }
285
286    /**
287     * The category for this owner.
288     * 
289     */
290    @java.lang.SuppressWarnings("all")
291    public void setCategory(final String category) {
292      this.category = category;
293    }
294  }
295
296
297  /**
298   * Represents the <a href="http://developers.facebook.com/docs/reference/api/event">Event Owner Category Graph API
299   * type</a>.
300   * 
301   * @author <a href="http://restfb.com">Mark Allen</a>
302   * @since 1.6.13
303   */
304  public static class Category extends AbstractFacebookType {
305    /**
306     * The unique identifier for this category.
307     * 
308     */
309    @Facebook
310    private String id;
311    /**
312     * The name of this category.
313     * 
314     */
315    @Facebook
316    private String name;
317    private static final long serialVersionUID = 1L;
318
319    /**
320     * The unique identifier for this category.
321     * 
322     * @return The unique identifier for this category.
323     */
324    @java.lang.SuppressWarnings("all")
325    public String getId() {
326      return this.id;
327    }
328
329    /**
330     * The unique identifier for this category.
331     * 
332     */
333    @java.lang.SuppressWarnings("all")
334    public void setId(final String id) {
335      this.id = id;
336    }
337
338    /**
339     * The name of this category.
340     * 
341     * @return The name of this category.
342     */
343    @java.lang.SuppressWarnings("all")
344    public String getName() {
345      return this.name;
346    }
347
348    /**
349     * The name of this category.
350     * 
351     */
352    @java.lang.SuppressWarnings("all")
353    public void setName(final String name) {
354      this.name = name;
355    }
356  }
357
358  @JsonMappingCompleted
359  void convertTime() {
360    // Sometimes the date comes back in short form - if long form parsing
361    // failed, try short instead
362    Date dateEnd = toDateFromLongFormat(rawEndTime);
363    endTime = dateEnd == null ? toDateFromShortFormat(rawEndTime) : dateEnd;
364    Date dateStart = toDateFromLongFormat(rawStartTime);
365    startTime = dateStart == null ? toDateFromShortFormat(rawStartTime) : dateStart;
366  }
367
368  @JsonMappingCompleted
369  protected void fillProfilePicture(JsonMapper jsonMapper) {
370    picture = convertPicture(jsonMapper, rawPicture);
371  }
372
373  /**
374   * The user who owns the event.
375   * 
376   * @return The user who owns the event.
377   */
378  @java.lang.SuppressWarnings("all")
379  public Owner getOwner() {
380    return this.owner;
381  }
382
383  /**
384   * The user who owns the event.
385   * 
386   */
387  @java.lang.SuppressWarnings("all")
388  public void setOwner(final Owner owner) {
389    this.owner = owner;
390  }
391
392  /**
393   * The category of the event.
394   *
395   * @return The category of the event
396   */
397  @GraphAPI(since = "2.4")
398  @java.lang.SuppressWarnings("all")
399  public String getCategory() {
400    return this.category;
401  }
402
403  /**
404   * The category of the event.
405   */
406  @java.lang.SuppressWarnings("all")
407  public void setCategory(final String category) {
408    this.category = category;
409  }
410
411  /**
412   * Can guests invite friends.
413   *
414   * @return Can guests invite friends
415   */
416  @java.lang.SuppressWarnings("all")
417  public Boolean getCanGuestsInvite() {
418    return this.canGuestsInvite;
419  }
420
421  /**
422   * Can guests invite friends.
423   */
424  @java.lang.SuppressWarnings("all")
425  public void setCanGuestsInvite(final Boolean canGuestsInvite) {
426    this.canGuestsInvite = canGuestsInvite;
427  }
428
429  /**
430   * Can see guest list.
431   *
432   * @return Can see guest list
433   */
434  @java.lang.SuppressWarnings("all")
435  public Boolean getGuestListEnabled() {
436    return this.guestListEnabled;
437  }
438
439  /**
440   * Can see guest list.
441   */
442  @java.lang.SuppressWarnings("all")
443  public void setGuestListEnabled(final Boolean guestListEnabled) {
444    this.guestListEnabled = guestListEnabled;
445  }
446
447  /**
448   * The long-form HTML description of the event.
449   * 
450   * @return The long-form HTML description of the event.
451   */
452  @java.lang.SuppressWarnings("all")
453  public String getDescription() {
454    return this.description;
455  }
456
457  /**
458   * The long-form HTML description of the event.
459   * 
460   */
461  @java.lang.SuppressWarnings("all")
462  public void setDescription(final String description) {
463    this.description = description;
464  }
465
466  /**
467   * The start time of the event.
468   * 
469   * @return The start time of the event.
470   */
471  @java.lang.SuppressWarnings("all")
472  public Date getStartTime() {
473    return this.startTime;
474  }
475
476  /**
477   * The start time of the event.
478   * 
479   */
480  @java.lang.SuppressWarnings("all")
481  public void setStartTime(final Date startTime) {
482    this.startTime = startTime;
483  }
484
485  /**
486   * The end time of the event.
487   * 
488   * @return The end time of the event.
489   */
490  @java.lang.SuppressWarnings("all")
491  public Date getEndTime() {
492    return this.endTime;
493  }
494
495  /**
496   * The end time of the event.
497   * 
498   */
499  @java.lang.SuppressWarnings("all")
500  public void setEndTime(final Date endTime) {
501    this.endTime = endTime;
502  }
503
504  /**
505   * Whether or not the event has been marked as canceled
506   *
507   * @return Whether or not the event has been marked as canceled
508   */
509  @java.lang.SuppressWarnings("all")
510  public Boolean getIsCanceled() {
511    return this.isCanceled;
512  }
513
514  /**
515   * Whether or not the event has been marked as canceled
516   */
517  @java.lang.SuppressWarnings("all")
518  public void setIsCanceled(final Boolean isCanceled) {
519    this.isCanceled = isCanceled;
520  }
521
522  /**
523   * The RSVP status of this event.
524   * 
525   * @return The RSVP status of this event.
526   */
527  @java.lang.SuppressWarnings("all")
528  public String getRsvpStatus() {
529    return this.rsvpStatus;
530  }
531
532  /**
533   * The RSVP status of this event.
534   * 
535   */
536  @java.lang.SuppressWarnings("all")
537  public void setRsvpStatus(final String rsvpStatus) {
538    this.rsvpStatus = rsvpStatus;
539  }
540
541  /**
542   * Number of people interested in the event.
543   *
544   * @return Number of people interested in the event
545   */
546  @GraphAPI(since = "2.1")
547  @java.lang.SuppressWarnings("all")
548  public Long getInterestedCount() {
549    return this.interestedCount;
550  }
551
552  /**
553   * Number of people interested in the event.
554   */
555  @java.lang.SuppressWarnings("all")
556  public void setInterestedCount(final Long interestedCount) {
557    this.interestedCount = interestedCount;
558  }
559
560  /**
561   * Whether the event is created by page or not.
562   *
563   * @return Whether the event is created by page or not
564   */
565  @java.lang.SuppressWarnings("all")
566  public Boolean getIsPageOwned() {
567    return this.isPageOwned;
568  }
569
570  /**
571   * Whether the event is created by page or not.
572   */
573  @java.lang.SuppressWarnings("all")
574  public void setIsPageOwned(final Boolean isPageOwned) {
575    this.isPageOwned = isPageOwned;
576  }
577
578  /**
579   * The visibility of this event. Can be 'OPEN', 'CLOSED', or 'SECRET'.
580   * 
581   * @return The visibility of this event. Can be 'OPEN', 'CLOSED', or 'SECRET'.
582   */
583  @java.lang.SuppressWarnings("all")
584  public String getPrivacy() {
585    return this.privacy;
586  }
587
588  /**
589   * The visibility of this event. Can be 'OPEN', 'CLOSED', or 'SECRET'.
590   * 
591   */
592  @java.lang.SuppressWarnings("all")
593  public void setPrivacy(final String privacy) {
594    this.privacy = privacy;
595  }
596
597  /**
598   * The last time the event was updated.
599   * 
600   * @return The last time the event was updated.
601   */
602  @java.lang.SuppressWarnings("all")
603  public Date getUpdatedTime() {
604    return this.updatedTime;
605  }
606
607  /**
608   * The last time the event was updated.
609   * 
610   */
611  @java.lang.SuppressWarnings("all")
612  public void setUpdatedTime(final Date updatedTime) {
613    this.updatedTime = updatedTime;
614  }
615
616  /**
617   * The URL to a location to buy tickets for this event (on Events for Pages only).
618   * 
619   * @return The URL to a location to buy tickets for this event (on Events for Pages only).
620   * @since 1.6.13
621   */
622  @java.lang.SuppressWarnings("all")
623  public String getTicketUri() {
624    return this.ticketUri;
625  }
626
627  /**
628   * The URL to a location to buy tickets for this event (on Events for Pages only).
629   * 
630   * @since 1.6.13
631   */
632  @java.lang.SuppressWarnings("all")
633  public void setTicketUri(final String ticketUri) {
634    this.ticketUri = ticketUri;
635  }
636
637  /**
638   * The event's picture.
639   * 
640   * @return The event's picture (only returned if you explicitly include picture in the fields param; example:
641   *         ?fields=id,name,picture)
642   * @since 1.6.13
643   */
644  @Override
645  @java.lang.SuppressWarnings("all")
646  public ProfilePictureSource getPicture() {
647    return this.picture;
648  }
649
650  /**
651   * The event's picture.
652   * 
653   * @since 1.6.13
654   */
655  @java.lang.SuppressWarnings("all")
656  public void setPicture(final ProfilePictureSource picture) {
657    this.picture = picture;
658  }
659
660  /**
661   * The group the event belongs to, if any.
662   * 
663   * @return The group the event belongs to, if any.
664   */
665  @java.lang.SuppressWarnings("all")
666  public Group getParentGroup() {
667    return this.parentGroup;
668  }
669
670  /**
671   * The group the event belongs to, if any.
672   * 
673   */
674  @java.lang.SuppressWarnings("all")
675  public void setParentGroup(final Group parentGroup) {
676    this.parentGroup = parentGroup;
677  }
678
679  /**
680   * Location associated with the event, if any.
681   *
682   * @return Location associated with the event, if any
683   */
684  @GraphAPI(since = "2.3")
685  @java.lang.SuppressWarnings("all")
686  public Place getPlace() {
687    return this.place;
688  }
689
690  /**
691   * Location associated with the event, if any.
692   */
693  @java.lang.SuppressWarnings("all")
694  public void setPlace(final Place place) {
695    this.place = place;
696  }
697
698  /**
699   * Should the time information be ignored in the dates for this event?
700   * 
701   * @return <tt>true</tt> if the time information be ignored in the dates for this event, <tt>false</tt> otherwise.
702   * @since 1.6.13
703   */
704  @java.lang.SuppressWarnings("all")
705  public Boolean getIsDateOnly() {
706    return this.isDateOnly;
707  }
708
709  /**
710   * Should the time information be ignored in the dates for this event?
711   * 
712   * @since 1.6.13
713   */
714  @java.lang.SuppressWarnings("all")
715  public void setIsDateOnly(final Boolean isDateOnly) {
716    this.isDateOnly = isDateOnly;
717  }
718
719  /**
720   * the timezone of the event
721   */
722  @java.lang.SuppressWarnings("all")
723  public String getTimezone() {
724    return this.timezone;
725  }
726
727  /**
728   * the timezone of the event
729   */
730  @java.lang.SuppressWarnings("all")
731  public void setTimezone(final String timezone) {
732    this.timezone = timezone;
733  }
734
735  /**
736   * Cover picture
737   *
738   * @return Cover picture
739   */
740  @Override
741  @java.lang.SuppressWarnings("all")
742  public CoverPhoto getCover() {
743    return this.cover;
744  }
745
746  /**
747   * Cover picture
748   */
749  @java.lang.SuppressWarnings("all")
750  public void setCover(final CoverPhoto cover) {
751    this.cover = cover;
752  }
753
754  /**
755   * Number of people attending the event
756   *
757   * @return Number of people attending the event
758   */
759  @GraphAPI(since = "2.1")
760  @java.lang.SuppressWarnings("all")
761  public Integer getAttendingCount() {
762    return this.attendingCount;
763  }
764
765  /**
766   * Number of people attending the event
767   */
768  @java.lang.SuppressWarnings("all")
769  public void setAttendingCount(final Integer attendingCount) {
770    this.attendingCount = attendingCount;
771  }
772
773  /**
774   * Number of people who declined the event
775   *
776   * @return Number of people who declined the event
777   */
778  @GraphAPI(since = "2.1")
779  @java.lang.SuppressWarnings("all")
780  public Integer getDeclinedCount() {
781    return this.declinedCount;
782  }
783
784  /**
785   * Number of people who declined the event
786   */
787  @java.lang.SuppressWarnings("all")
788  public void setDeclinedCount(final Integer declinedCount) {
789    this.declinedCount = declinedCount;
790  }
791
792  /**
793   * Number of people who maybe going to the event
794   *
795   * @return Number of people who maybe going to the event
796   */
797  @GraphAPI(since = "2.1")
798  @java.lang.SuppressWarnings("all")
799  public Integer getMaybeCount() {
800    return this.maybeCount;
801  }
802
803  /**
804   * Number of people who maybe going to the event
805   */
806  @java.lang.SuppressWarnings("all")
807  public void setMaybeCount(final Integer maybeCount) {
808    this.maybeCount = maybeCount;
809  }
810
811  /**
812   * Number of people who did not reply to the event
813   *
814   * @return Number of people who did not reply to the event
815   */
816  @GraphAPI(since = "2.1")
817  @java.lang.SuppressWarnings("all")
818  public Integer getNoreplyCount() {
819    return this.noreplyCount;
820  }
821
822  /**
823   * Number of people who did not reply to the event
824   */
825  @java.lang.SuppressWarnings("all")
826  public void setNoreplyCount(final Integer noreplyCount) {
827    this.noreplyCount = noreplyCount;
828  }
829}