///
/// DetailedFileInfo.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 `DetailedFileInfo`, backed by a C++ struct.
 */
public typealias DetailedFileInfo = margelo.nitro.one.DetailedFileInfo

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

  /**
   * Create a new instance of `DetailedFileInfo`.
   */
  init(exists: Bool, size: Double, modificationTime: Double?, creationTime: Double?, mimeType: String) {
    self.init(exists, size, { () -> 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()
      }
    }(), std.string(mimeType))
  }

  @inline(__always)
  var exists: Bool {
    return self.__exists
  }
  
  @inline(__always)
  var size: Double {
    return self.__size
  }
  
  @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 mimeType: String {
    return String(self.__mimeType)
  }
}
