// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from set.djinni

#import "DBSetRecord+Private.h"
#import "DJIDate.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>

static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");

@implementation DBSetRecord

- (id)initWithSetRecord:(DBSetRecord *)setRecord
{
    if (self = [super init]) {
        std::vector<NSString *> _setTempVector;
        _setTempVector.reserve([setRecord.set count]);
        for (NSString *currentValue_0 in setRecord.set) {
            NSString *copiedValue_0;
            copiedValue_0 = [currentValue_0 copy];
            _setTempVector.push_back(copiedValue_0);
        }
        _set = [NSSet setWithObjects:&_setTempVector[0] count:_setTempVector.size()];
    }
    return self;
}

- (id)initWithSet:(NSSet *)set
{
    if (self = [super init]) {
        _set = set;
    }
    return self;
}

- (id)initWithCppSetRecord:(const SetRecord &)setRecord
{
    if (self = [super init]) {
        std::vector<NSString *> _setTempVector;
        _setTempVector.reserve(setRecord.set.size());
        for (const auto & cppValue_0 : setRecord.set) {
            NSString *objcValue_0 = [[NSString alloc] initWithBytes:cppValue_0.data()
                    length:cppValue_0.length()
                    encoding:NSUTF8StringEncoding];
            _setTempVector.push_back(objcValue_0);
        }
        _set = [NSSet setWithObjects:&_setTempVector[0] count:_setTempVector.size()];
    }
    return self;
}

- (SetRecord)cppSetRecord
{
    std::unordered_set<std::string> set;
    for (NSString *objcValue_0 in _set) {
        std::string cppValue_0([objcValue_0 UTF8String], [objcValue_0 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
        set.insert(std::move(cppValue_0));
    }
    return SetRecord(
            std::move(set));
}

@end
