GMSOpeningHours.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. //
  2. // GMSOpeningHours.h
  3. // Google Places SDK for iOS
  4. //
  5. // Copyright 2018 Google LLC
  6. //
  7. // Usage of this SDK is subject to the Google Maps/Google Earth APIs Terms of
  8. // Service: https://developers.google.com/maps/terms
  9. //
  10. #import <Foundation/Foundation.h>
  11. NS_ASSUME_NONNULL_BEGIN
  12. /**
  13. * \defgroup OpenNowStatus GMSOpenNowStatus
  14. * @{
  15. */
  16. /**
  17. * Describes the current open status of a place.
  18. */
  19. typedef NS_ENUM(NSInteger, GMSOpenNowStatus) {
  20. /** The place is open now. */
  21. GMSOpenNowStatusYes,
  22. /** The place is not open now. */
  23. GMSOpenNowStatusNo,
  24. /** Whether the place is open now is unknown. */
  25. GMSOpenNowStatusUnknown,
  26. };
  27. /**@}*/
  28. /**
  29. * \defgroup DayOfWeek GMSDayOfWeek
  30. * @{
  31. */
  32. /**
  33. * The fields represent individual days of the week. Matches NSDateComponents.weekday index.
  34. * Refer to https://developer.apple.com/documentation/foundation/nsdatecomponents/1410442-weekday
  35. */
  36. typedef NS_ENUM(NSUInteger, GMSDayOfWeek) {
  37. GMSDayOfWeekSunday = 1,
  38. GMSDayOfWeekMonday = 2,
  39. GMSDayOfWeekTuesday = 3,
  40. GMSDayOfWeekWednesday = 4,
  41. GMSDayOfWeekThursday = 5,
  42. GMSDayOfWeekFriday = 6,
  43. GMSDayOfWeekSaturday = 7,
  44. };
  45. /**@}*/
  46. /**
  47. * A class representing time in hours and minutes in a 24hr clock.
  48. */
  49. @interface GMSTime : NSObject
  50. /**
  51. * The hour representation of time in a day. (Range is between 0-23).
  52. */
  53. @property(nonatomic, readonly, assign) NSUInteger hour;
  54. /**
  55. * The minute representation of time in a 1 hr period. (Range is between 0-59).
  56. */
  57. @property(nonatomic, readonly, assign) NSUInteger minute;
  58. @end
  59. /**
  60. * A class representing a open/close event in |GMSPeriod|.
  61. */
  62. @interface GMSEvent : NSObject
  63. /**
  64. * Day of week the associated with the event.
  65. */
  66. @property(nonatomic, readonly, assign) GMSDayOfWeek day;
  67. /**
  68. * The representation of time of the event in 24hr clock.
  69. */
  70. @property(nonatomic, readonly, strong) GMSTime *time;
  71. @end
  72. /**
  73. * A class representing a period of time where the place is operating for a |GMSPlace|.
  74. * It contains an open |GMSEvent| and an optional close |GMSEvent|. The close event will be nil
  75. * if the period is open 24hrs.
  76. */
  77. @interface GMSPeriod : NSObject
  78. /**
  79. * The open event of this period.
  80. * Each |GMSPeriod| is guaranteed to have an open event.
  81. * If the period is representing open 24hrs, it will only have the openEvent with time as "0000".
  82. */
  83. @property(nonatomic, readonly, strong) GMSEvent *openEvent;
  84. /**
  85. * The close event of this period.
  86. * Can be nil if period is open 24hrs.
  87. */
  88. @property(nullable, nonatomic, readonly, strong) GMSEvent *closeEvent;
  89. @end
  90. /**
  91. * A class to handle storing and accessing opening hours information for |GMSPlace|.
  92. */
  93. @interface GMSOpeningHours : NSObject
  94. /**
  95. * Contains all |GMSPeriod|s of open and close events for the week.
  96. *
  97. * Note: Multiple periods can be associated with a day (eg. Monday 7am - Monday 2pm,
  98. * Monday 5pm - Monday 10pm).
  99. *
  100. * Periods may also span multiple days (eg Friday 7pm - Saturday 2am).
  101. */
  102. @property(nullable, nonatomic, readonly, strong) NSArray<GMSPeriod *> *periods;
  103. /**
  104. * Contains localized strings of the daily opening hours for the week.
  105. *
  106. * Note: The order of the text depends on the language and may begin on Monday or Sunday.
  107. * Do not use the GMSDayOfWeek enum to index into the array.
  108. */
  109. @property(nullable, nonatomic, readonly, strong) NSArray<NSString *> *weekdayText;
  110. @end
  111. NS_ASSUME_NONNULL_END