text: /* Copyright 2017 Urban Airship and Contributors */
  
  #import <Foundation/Foundation.h>
  #import "UAScheduleTrigger.h"
  #import "UAScheduleDelay.h"
  
  NS_ASSUME_NONNULL_BEGIN
  
  /**
   * Represents the possible error conditions when deserializing schedule info from JSON.
   */
  typedef NS_ENUM(NSInteger, UAActionScheduleInfoErrorCode) {
      /**
       * Indicates an error with the schedule info JSON definition.
       */
      UAActionScheduleInfoErrorCodeInvalidJSON,
  };
  
  /**
   * The domain for NSErrors generated by `actionScheduleInfoWithJSON:error:`.
   */
  extern NSString * const UAActionScheduleInfoErrorDomain;
  
  /**
   * Max number of triggers a schedule can support.
   */
  extern NSUInteger const UAActionScheduleInfoMaxTriggers;
  
  /**
   * JSON key for the schedule's actions.
   */
  extern NSString *const UAActionScheduleInfoActionsKey;
  
  /**
   * JSON key for the schedule's limit.
   */
  extern NSString *const UAActionScheduleInfoLimitKey;
  
  /**
   * JSON key for the schedule's group.
   */
  extern NSString *const UAActionScheduleInfoGroupKey;
  
  /**
   * JSON key for the schedule's end.
   */
  extern NSString *const UAActionScheduleInfoEndKey;
  
  /**
   * JSON key for the schedule's start.
   */
  extern NSString *const UAActionScheduleInfoStartKey;
  
  /**
   * JSON key for the schedule's triggers.
   */
  extern NSString *const UAActionScheduleInfoTriggersKey;
  
  /**
   * JSON key for the schedule's delay.
   */
  extern NSString *const UAActionScheduleInfoDelayKey;
  
  /**
   * Builder class for a UAActionScheduleInfo.
   */
  @interface UAActionScheduleInfoBuilder : NSObject
  
  ///---------------------------------------------------------------------------------------
  /// @name Action Schedule Info Builder Properties
  ///---------------------------------------------------------------------------------------
  
  /**
   * Actions payload to run when the schedule is triggered.
   */
  @property(nonatomic, strong, nullable) NSDictionary *actions;
  
  /**
   * Number of times the actions will be triggered until the schedule is
   * canceled.
   */
  @property(nonatomic, assign) NSUInteger limit;
  
  /**
   * Array of triggers. Triggers define conditions on when to run
   * the actions.
   */
  @property(nonatomic, strong, nullable) NSArray<UAScheduleTrigger *> *triggers;
  
  /**
   * The schedule's group.
   */
  @property(nonatomic, copy, nullable) NSString *group;
  
  /**
   * The schedule's start time.
   */
  @property(nonatomic, strong, nullable) NSDate *start;
  
  /**
   * The schedule's end time. After the end time the schedule will be canceled.
   */
  @property(nonatomic, strong, nullable) NSDate *end;
  
  /**
   * The schedule's delay.
   */
  @property(nonatomic, strong, nullable) UAScheduleDelay *delay;
  
  @end
  
  /**
   * Defines the scheduled action.
   */
  @interface UAActionScheduleInfo : NSObject
  
  ///---------------------------------------------------------------------------------------
  /// @name Action Schedule Info Properties
  ///---------------------------------------------------------------------------------------
  
  /**
   * Actions payload to run when the schedule is triggered.
   */
  @property(nonatomic, readonly) NSDictionary *actions;
  
  /**
   * Array of triggers. Triggers define conditions on when to run
   * the actions.
   */
  @property(nonatomic, readonly) NSArray<UAScheduleTrigger *> *triggers;
  
  /**
   * Number of times the actions will be triggered until the schedule is
   * canceled.
   */
  @property(nonatomic, readonly) NSUInteger limit;
  
  /**
   * The schedule's group.
   */
  @property(nonatomic, readonly, nullable) NSString *group;
  
  /**
   * The schedule's start time.
   */
  @property(nonatomic, readonly) NSDate *start;
  
  /**
   * The schedule's end time. After the end time the schedule will be canceled.
   */
  @property(nonatomic, readonly) NSDate *end;
  
  /**
   * The schedule's delay.
   */
  @property(nonatomic, readonly) UAScheduleDelay *delay;
  
  /**
   * Checks if the schedule info is valid. A valid schedule
   * must contain at least 1 action, contains between 1 to 10 triggers,
   * if a delay is defined it must be valid, and the end time must be
   * after the start time. Invalid schedules will not be scheduled.
   */
  @property(nonatomic, readonly) BOOL isValid;
  
  ///---------------------------------------------------------------------------------------
  /// @name Action Schedule Info Factories
  ///---------------------------------------------------------------------------------------
  
  /**
   * Factory method to create an action schedule info from a JSON payload.
   *
   * @param json The JSON payload.
   * @param error An NSError pointer for storing errors, if applicable.
   * @return An action schedule info or `nil` if the JSON is invalid.
   */
  + (nullable instancetype)actionScheduleInfoWithJSON:(id)json error:(NSError * _Nullable *)error;
  
  /**
   * Creates an action schedule info with a builder block.
   *
   * @return The action schedule info.
   */
  + (instancetype)actionScheduleInfoWithBuilderBlock:(void(^)(UAActionScheduleInfoBuilder *builder))builderBlock;
  
  ///---------------------------------------------------------------------------------------
  /// @name Action Schedule Info Management
  ///---------------------------------------------------------------------------------------
  
  /**
   * Checks if the schedule info is equal to another schedule info
   *
   * @param scheduleInfo The other schedule info to compare against.
   * @return `YES` if the schedule infos are equal, otherwise `NO`.
   */
  - (BOOL)isEqualToScheduleInfo:(nullable UAActionScheduleInfo *)scheduleInfo;
  
  
  @end
  
  NS_ASSUME_NONNULL_END
  
  
  