///
/// DetailedDirectoryInfo.swift
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

import NitroModules

/**
 * Represents an instance of `DetailedDirectoryInfo`, backed by a C++ struct.
 */
public typealias DetailedDirectoryInfo = margelo.nitro.one.DetailedDirectoryInfo

public extension DetailedDirectoryInfo {
  private typealias bridge = margelo.nitro.one.bridge.swift

  /**
   * Create a new instance of `DetailedDirectoryInfo`.
   */
  init(exists: Bool, size: Double?, modificationTime: Double?, creationTime: Double?, files: [String]?) {
    self.init(exists, { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = size {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = modificationTime {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = creationTime {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__vector_std__string__ in
      if let __unwrappedValue = files {
        return bridge.create_std__optional_std__vector_std__string__({ () -> bridge.std__vector_std__string_ in
          var __vector = bridge.create_std__vector_std__string_(__unwrappedValue.count)
          for __item in __unwrappedValue {
            __vector.push_back(std.string(__item))
          }
          return __vector
        }())
      } else {
        return .init()
      }
    }())
  }

  @inline(__always)
  var exists: Bool {
    return self.__exists
  }
  
  @inline(__always)
  var size: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__size) {
        let __unwrapped = bridge.get_std__optional_double_(self.__size)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var modificationTime: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__modificationTime) {
        let __unwrapped = bridge.get_std__optional_double_(self.__modificationTime)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var creationTime: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__creationTime) {
        let __unwrapped = bridge.get_std__optional_double_(self.__creationTime)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var files: [String]? {
    return { () -> [String]? in
      if bridge.has_value_std__optional_std__vector_std__string__(self.__files) {
        let __unwrapped = bridge.get_std__optional_std__vector_std__string__(self.__files)
        return __unwrapped.map({ __item in String(__item) })
      } else {
        return nil
      }
    }()
  }
}
