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

import NitroModules

/// Represents an instance of `MerchantCounterparty`, backed by a C++ struct.
public typealias MerchantCounterparty = margelo.nitro.rncandle.MerchantCounterparty

extension MerchantCounterparty {
  private typealias bridge = margelo.nitro.rncandle.bridge.swift

  /**
   * Create a new instance of `MerchantCounterparty`.
   */
  public init(kind: String, name: String, logoURL: String, location: MerchantLocation?) {
    self.init(
      std.string(kind), std.string(name), std.string(logoURL),
      { () -> bridge.std__optional_MerchantLocation_ in
        if let __unwrappedValue = location {
          return bridge.create_std__optional_MerchantLocation_(__unwrappedValue)
        } else {
          return .init()
        }
      }())
  }

  public var kind: String {
    @inline(__always)
    get {
      return String(self.__kind)
    }
    @inline(__always)
    set {
      self.__kind = std.string(newValue)
    }
  }

  public var name: String {
    @inline(__always)
    get {
      return String(self.__name)
    }
    @inline(__always)
    set {
      self.__name = std.string(newValue)
    }
  }

  public var logoURL: String {
    @inline(__always)
    get {
      return String(self.__logoURL)
    }
    @inline(__always)
    set {
      self.__logoURL = std.string(newValue)
    }
  }

  public var location: MerchantLocation? {
    @inline(__always)
    get {
      return { () -> MerchantLocation? in
        if bridge.has_value_std__optional_MerchantLocation_(self.__location) {
          let __unwrapped = bridge.get_std__optional_MerchantLocation_(self.__location)
          return __unwrapped
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__location = { () -> bridge.std__optional_MerchantLocation_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_MerchantLocation_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
}
