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

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

  /**
   * Create a new instance of `AppleAuthSignInOptions`.
   */
  init(requestedScopes: [AppleAuthScope]?, nonce: String?, state: String?) {
    self.init({ () -> bridge.std__optional_std__vector_AppleAuthScope__ in
      if let __unwrappedValue = requestedScopes {
        return bridge.create_std__optional_std__vector_AppleAuthScope__({ () -> bridge.std__vector_AppleAuthScope_ in
          var __vector = bridge.create_std__vector_AppleAuthScope_(__unwrappedValue.count)
          for __item in __unwrappedValue {
            __vector.push_back(__item)
          }
          return __vector
        }())
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = nonce {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = state {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }())
  }

  @inline(__always)
  var requestedScopes: [AppleAuthScope]? {
    return { () -> [AppleAuthScope]? in
      if bridge.has_value_std__optional_std__vector_AppleAuthScope__(self.__requestedScopes) {
        let __unwrapped = bridge.get_std__optional_std__vector_AppleAuthScope__(self.__requestedScopes)
        return __unwrapped.map({ __item in __item })
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var nonce: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__nonce) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__nonce)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var state: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__state) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__state)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
}
