//
//  CCHFileSizeItemFilter.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, CCHFileSizeItemFilterOperator) {
  CCHFileSizeItemFilterOperatorIsEqualTo = 0, //the UI relies on this starting at zero...
  CCHFileSizeItemFilterOperatorIsNotEqualTo,
  CCHFileSizeItemFilterOperatorIsLessThan,
  CCHFileSizeItemFilterOperatorIsGreaterThan,
  CCHFileSizeItemFilterOperatorIsLessThanOrEqualTo,
  CCHFileSizeItemFilterOperatorIsGreaterThanOrEqualTo //...and this being 5
};

typedef NS_ENUM(NSUInteger, CCHFileSizeItemFilterSizeUnit) {
  CCHFileSizeItemFilterSizeUnitBytes = 0, //the UI relies on this starting at zero...
  CCHFileSizeItemFilterSizeUnitKB,
  CCHFileSizeItemFilterSizeUnitMB,
  CCHFileSizeItemFilterSizeUnitGB //...and this being 3
};


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

@interface CCHFileSizeItemFilter : CCHAbstractComparisonItemFilter <CODPropertyListRepresentationProtocol>

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

@property(readwrite) CCHFileSizeItemFilterOperator operator; //defaults to “is equal to”
@property(readwrite) id rightHandSide; //must be nil or NSNumber. defaults to nil (which is treated as zero, because anything else makes no sense--the right hand side text field has our good old number formatter on it).
@property(readwrite) CCHFileSizeItemFilterSizeUnit sizeUnit; //defaults to bytes

@end
