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

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

  /**
   * Create a new instance of `CalendarInfo`.
   */
  init(calendar: String?, timeZone: String?, uses24hourClock: Bool?, firstWeekday: Double?) {
    self.init({ () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = calendar {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = timeZone {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_bool_ in
      if let __unwrappedValue = uses24hourClock {
        return bridge.create_std__optional_bool_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = firstWeekday {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }())
  }

  @inline(__always)
  var calendar: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__calendar) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__calendar)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var timeZone: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__timeZone) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__timeZone)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var uses24hourClock: Bool? {
    return { () -> Bool? in
      if bridge.has_value_std__optional_bool_(self.__uses24hourClock) {
        let __unwrapped = bridge.get_std__optional_bool_(self.__uses24hourClock)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var firstWeekday: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__firstWeekday) {
        let __unwrapped = bridge.get_std__optional_double_(self.__firstWeekday)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
}
