#import "DevMenuREAStyleNode.h"

#import "DevMenuREANodesManager.h"

@implementation DevMenuREAStyleNode
{
  NSMutableDictionary<NSString *, DevMenuREANodeID> *_styleConfig;
}

- (instancetype)initWithID:(DevMenuREANodeID)nodeID
                    config:(NSDictionary<NSString *, id> *)config;
{
  if ((self = [super initWithID:nodeID config:config])) {
    _styleConfig = config[@"style"];
  }
  return self;
}

- (id)evaluate
{
  NSMutableDictionary *styles = [NSMutableDictionary new];
  for (NSString *prop in _styleConfig) {
    DevMenuREANode *propNode = [self.nodesManager findNodeByID:_styleConfig[prop]];
    styles[prop] = [propNode value];
  }

  return styles;
}

@end
