GMSOpeningHours.h 3.37 KB
Newer Older
Julio Hermosa committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
//
//  GMSOpeningHours.h
//  Google Places SDK for iOS
//
//  Copyright 2018 Google Inc.
//
//  Usage of this SDK is subject to the Google Maps/Google Earth APIs Terms of
//  Service: https://developers.google.com/maps/terms
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/**
 * \defgroup OpenNowStatus GMSOpenNowStatus
 * @{
 */

/**
 * Describes the current open status of a place.
 */
typedef NS_ENUM(NSInteger, GMSOpenNowStatus) {
  /** The place is open now. */
  GMSOpenNowStatusYes,
  /** The place is not open now. */
  GMSOpenNowStatusNo,
  /** Whether the place is open now is unknown. */
  GMSOpenNowStatusUnknown,
};

/**@}*/

/**
 * \defgroup DayOfWeek GMSDayOfWeek
 * @{
 */

/**
 * The fields represent individual days of the week. Matches NSDateComponents.weekday index.
 * Refer to https://developer.apple.com/documentation/foundation/nsdatecomponents/1410442-weekday
 */
typedef NS_ENUM(NSUInteger, GMSDayOfWeek) {
  GMSDayOfWeekSunday = 1,
  GMSDayOfWeekMonday = 2,
  GMSDayOfWeekTuesday = 3,
  GMSDayOfWeekWednesday = 4,
  GMSDayOfWeekThursday = 5,
  GMSDayOfWeekFriday = 6,
  GMSDayOfWeekSaturday = 7,
};

/**@}*/

/**
 * A class representing time in hours and minutes in a 24hr clock.
 */
@interface GMSTime : NSObject

/**
 * The hour representation of time in a day. (Range is between 0-23).
 */
@property(nonatomic, readonly, assign) NSUInteger hour;

/**
 * The minute representation of time in a 1 hr period. (Range is between 0-59).
 */
@property(nonatomic, readonly, assign) NSUInteger minute;

@end

/**
 * A class representing a open/close event in |GMSPeriod|.
 */
@interface GMSEvent : NSObject

/**
 * Day of week the associated with the event.
 */
@property(nonatomic, readonly, assign) GMSDayOfWeek day;

/**
 * The representation of time of the event in 24hr clock.
 */
@property(nonatomic, readonly, strong) GMSTime *time;

@end

/**
 * A class representing a period of time where the place is operating for a |GMSPlace|.
 * It contains an open |GMSEvent| and an optional close |GMSEvent|. The close event will be nil
 * if the period is open 24hrs.
 */
@interface GMSPeriod : NSObject

/**
 * The open event of this period.
 * Each |GMSPeriod| is guaranteed to have an open event.
 * If the period is representing open 24hrs, it will only have the openEvent with time as "0000".
 */
@property(nonatomic, readonly, strong) GMSEvent *openEvent;

/**
 * The close event of this period.
 * Can be nil if period is open 24hrs.
 */
@property(nullable, nonatomic, readonly, strong) GMSEvent *closeEvent;

@end

/**
 * A class to handle storing and accessing opening hours information for |GMSPlace|.
 */
@interface GMSOpeningHours : NSObject

/**
 * Contains all |GMSPeriod|s of open and close events for the week.
 *
 * Note: Multiple periods can be associated with a day (eg. Monday 7am - Monday 2pm,
 *                                                          Monday 5pm - Monday 10pm).
 *
 *       Periods may also span multiple days (eg Friday 7pm - Saturday 2am).
 */
@property(nullable, nonatomic, readonly, strong) NSArray<GMSPeriod *> *periods;

/**
 * Contains localized strings of the daily opening hours for the week.
 *
 * Note: The order of the text depends on the language and may begin on Monday or Sunday.
 *       Do not use the GMSDayOfWeek enum to index into the array.
 */
@property(nullable, nonatomic, readonly, strong) NSArray<NSString *> *weekdayText;

@end

NS_ASSUME_NONNULL_END