//
//  NSDictionary+YSRACSequenceAdditions.m
//  ReactiveObjC
//
//  Created by Justin Spahr-Summers on 2012-10-29.
//  Copyright (c) 2012 GitHub. All rights reserved.
//

#import "NSDictionary+YSRACSequenceAdditions.h"
#import "NSArray+YSRACSequenceAdditions.h"
#import "YSRACSequence.h"
#import "YSRACTuple.h"

@implementation NSDictionary (YSRACSequenceAdditions)

- (YSRACSequence *)ysrac_sequence {
	NSDictionary *immutableDict = [self copy];

	// TODO: First class support for dictionary sequences.
	return [immutableDict.allKeys.ysrac_sequence map:^(id key) {
		id value = immutableDict[key];
		return YSRACTuplePack(key, value);
	}];
}

- (YSRACSequence *)ysrac_keySequence {
	return self.allKeys.ysrac_sequence;
}

- (YSRACSequence *)ysrac_valueSequence {
	return self.allValues.ysrac_sequence;
}

@end
