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

public extension DateFilter {
  private typealias bridge = margelo.nitro.healthkit.bridge.swift

  /**
   * Create a new instance of `DateFilter`.
   */
  init(startDate: Date?, endDate: Date?, strictEndDate: Bool?, strictStartDate: Bool?) {
    self.init({ () -> bridge.std__optional_std__chrono__system_clock__time_point_ in
      if let __unwrappedValue = startDate {
        return bridge.create_std__optional_std__chrono__system_clock__time_point_(__unwrappedValue.toCpp())
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__chrono__system_clock__time_point_ in
      if let __unwrappedValue = endDate {
        return bridge.create_std__optional_std__chrono__system_clock__time_point_(__unwrappedValue.toCpp())
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_bool_ in
      if let __unwrappedValue = strictEndDate {
        return bridge.create_std__optional_bool_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_bool_ in
      if let __unwrappedValue = strictStartDate {
        return bridge.create_std__optional_bool_(__unwrappedValue)
      } else {
        return .init()
      }
    }())
  }

  @inline(__always)
  var startDate: Date? {
    return { () -> Date? in
      if bridge.has_value_std__optional_std__chrono__system_clock__time_point_(self.__startDate) {
        let __unwrapped = bridge.get_std__optional_std__chrono__system_clock__time_point_(self.__startDate)
        return Date(fromChrono: __unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var endDate: Date? {
    return { () -> Date? in
      if bridge.has_value_std__optional_std__chrono__system_clock__time_point_(self.__endDate) {
        let __unwrapped = bridge.get_std__optional_std__chrono__system_clock__time_point_(self.__endDate)
        return Date(fromChrono: __unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var strictEndDate: Bool? {
    return { () -> Bool? in
      if bridge.has_value_std__optional_bool_(self.__strictEndDate) {
        let __unwrapped = bridge.get_std__optional_bool_(self.__strictEndDate)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var strictStartDate: Bool? {
    return { () -> Bool? in
      if bridge.has_value_std__optional_bool_(self.__strictStartDate) {
        let __unwrapped = bridge.get_std__optional_bool_(self.__strictStartDate)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
}
