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

public extension ThorShape {
  private typealias bridge = margelo.nitro.thor.bridge.swift

  /**
   * Create a new instance of `ThorShape`.
   */
  init(type: ThorShapeType, fill: String?, stroke: String?, strokeWidth: Double?, x: Double?, y: Double?, width: Double?, height: Double?, rx: Double?, ry: Double?, cx: Double?, cy: Double?, radius: Double?, x1: Double?, y1: Double?, x2: Double?, y2: Double?, points: [Double]?, closed: Bool?) {
    self.init(type, { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = fill {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = stroke {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = strokeWidth {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = x {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = y {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = width {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = height {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = rx {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = ry {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = cx {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = cy {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = radius {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = x1 {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = y1 {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = x2 {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = y2 {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__vector_double__ in
      if let __unwrappedValue = points {
        return bridge.create_std__optional_std__vector_double__({ () -> bridge.std__vector_double_ in
          var __vector = bridge.create_std__vector_double_(__unwrappedValue.count)
          for __item in __unwrappedValue {
            __vector.push_back(__item)
          }
          return __vector
        }())
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_bool_ in
      if let __unwrappedValue = closed {
        return bridge.create_std__optional_bool_(__unwrappedValue)
      } else {
        return .init()
      }
    }())
  }

  @inline(__always)
  var type: ThorShapeType {
    return self.__type
  }
  
  @inline(__always)
  var fill: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__fill) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__fill)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var stroke: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__stroke) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__stroke)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var strokeWidth: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__strokeWidth) {
        let __unwrapped = bridge.get_std__optional_double_(self.__strokeWidth)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var x: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__x) {
        let __unwrapped = bridge.get_std__optional_double_(self.__x)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var y: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__y) {
        let __unwrapped = bridge.get_std__optional_double_(self.__y)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var width: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__width) {
        let __unwrapped = bridge.get_std__optional_double_(self.__width)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var height: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__height) {
        let __unwrapped = bridge.get_std__optional_double_(self.__height)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var rx: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__rx) {
        let __unwrapped = bridge.get_std__optional_double_(self.__rx)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var ry: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__ry) {
        let __unwrapped = bridge.get_std__optional_double_(self.__ry)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var cx: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__cx) {
        let __unwrapped = bridge.get_std__optional_double_(self.__cx)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var cy: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__cy) {
        let __unwrapped = bridge.get_std__optional_double_(self.__cy)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var radius: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__radius) {
        let __unwrapped = bridge.get_std__optional_double_(self.__radius)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var x1: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__x1) {
        let __unwrapped = bridge.get_std__optional_double_(self.__x1)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var y1: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__y1) {
        let __unwrapped = bridge.get_std__optional_double_(self.__y1)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var x2: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__x2) {
        let __unwrapped = bridge.get_std__optional_double_(self.__x2)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var y2: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__y2) {
        let __unwrapped = bridge.get_std__optional_double_(self.__y2)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var points: [Double]? {
    return { () -> [Double]? in
      if bridge.has_value_std__optional_std__vector_double__(self.__points) {
        let __unwrapped = bridge.get_std__optional_std__vector_double__(self.__points)
        return __unwrapped.map({ __item in __item })
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var closed: Bool? {
    return { () -> Bool? in
      if bridge.has_value_std__optional_bool_(self.__closed) {
        let __unwrapped = bridge.get_std__optional_bool_(self.__closed)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
}
