#import "Sales.h"
#import "Lang.h"
#import "SDK.h"
#import "CocoaUtils.h"
#import "Utility.h"

@implementation Sales

#pragma mark - Property

- (NSString *)localizedPurchaseDateString {
	return [Utility localizedStringWithStandardDatetimeString:[NSString stringWithFormat:@"%@ %@", self.sale_date, self.sale_time]];
}

#pragma mark - Public

+ (NSArray *)toEntries:(NSArray *)orders {
	return [orders valueForKeyPath:@"@unionOfArrays.entries"];
}

+ (NSArray *)toStocks:(NSArray *)orders {
	return [[self toEntries:orders] valueForKeyPath:@"@unionOfArrays.serialStocks"];
}

@end
