//
//  CCHPureGMTDateItemFilter.h
//  Shared
//
//  Created by Robinson on 18.07.2014.
//  Copyright (c) 2014 Coding Turtle. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CCHAbstractComparisonItemFilter.h"
#import "CODPropertyListRepresentationProtocol.h"


typedef NS_ENUM(NSUInteger, CCHPureGMTDateItemFilterOperator) {
  CCHPureGMTDateItemFilterOperatorIsEqualTo = 0, //the “smart list date comparison right view” stuff relies on this starting at zero...
  CCHPureGMTDateItemFilterOperatorIsNotEqualTo,
  CCHPureGMTDateItemFilterOperatorIsBefore,
  CCHPureGMTDateItemFilterOperatorIsAfter,
  CCHPureGMTDateItemFilterOperatorIsEqualToOrBefore,
  CCHPureGMTDateItemFilterOperatorIsEqualToOrAfter,
  CCHPureGMTDateItemFilterOperatorIsToday,
  CCHPureGMTDateItemFilterOperatorIsNotToday,
  CCHPureGMTDateItemFilterOperatorIsWithinTheLast,
  CCHPureGMTDateItemFilterOperatorIsWithinTheNext,
  CCHPureGMTDateItemFilterOperatorIsTodayOrWithinTheLast,
  CCHPureGMTDateItemFilterOperatorIsTodayOrWithinTheNext //...and this being 11
};


//This class assumes that “leftHandSideRepresentedObject” returns a string.
//It also assumes that “valueForKey:” called on an item with that string returns either nil or a date.

//We are talking about an “Ordinary” date in the sense that the left hand side is a “full date,” i.e., a specific time point, i.e., a date with a time attached to it.
//We have separated it from a “pure GMT” date because down the road we may want to expose the time of the “ordinary” dates. If that happens, some of the operators in the item filter would have to change names, e.g., “is equal to” to “is on”.

@interface CCHPureGMTDateItemFilter : CCHAbstractComparisonItemFilter <CODPropertyListRepresentationProtocol>

- (id)initWithLeftHandSideRepresentedObject:(id)leftHandSideRepresentedObject;

@property(readwrite) CCHPureGMTDateItemFilterOperator operator; //defaults to “isEqualTo”
@property(readwrite) id rightHandSide; //must be nil or NSNumber for the “within the next/last” operators, nil for the “today” operators, and nil or NSDate for the other operators. defaults to nil.

@end
