//
//  CCHStringItemFilter.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, CCHStringItemFilterOperator) {
  CCHStringItemFilterOperatorContains = 0, //the “smart list string comparison right view” stuff relies on this starting at zero...
  CCHStringItemFilterOperatorDoesNotContain,
  CCHStringItemFilterOperatorBeginsWith,
  CCHStringItemFilterOperatorEndsWith,
  CCHStringItemFilterOperatorIsEqualTo,
  CCHStringItemFilterOperatorIsNotEqualTo,
  CCHStringItemFilterOperatorIsContainedIn,
  CCHStringItemFilterOperatorIsNotContainedIn,
  CCHStringItemFilterOperatorIsAtTheBeginningOf,
  CCHStringItemFilterOperatorIsAtTheEndOf,
  
  CCHStringItemFilterOperatorHasALengthOf,
  CCHStringItemFilterOperatorDoesNotHaveALengthOf,
  CCHStringItemFilterOperatorIsShorterThan,
  CCHStringItemFilterOperatorIsLongerThan,
  CCHStringItemFilterOperatorIsNotLongerThan,
  CCHStringItemFilterOperatorIsNotShorterThan //...and this being 15
};


//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 string.

@interface CCHStringItemFilter : CCHAbstractComparisonItemFilter <CODPropertyListRepresentationProtocol>

- (id)initWithLeftHandSideRepresentedObject:(NSString *)leftHandSideRepresentedObject;

@property(readwrite) CCHStringItemFilterOperator operator; //defaults to “contains”
@property(readwrite) id rightHandSide; //must be nil or NSNumber for the “length” operators, and nil or NSString for the other operators. defaults to nil.

@end
