using CxxWrap: ConstCxxRef
using CxxWrap.StdLib: StdString, SharedPtr, UniquePtr, WeakPtr
using CxxWrap.CxxWrapCore:
    CxxBool,
    CxxChar,
    CxxWchar,
    CxxSignedChar,
    CxxUChar,
    CxxShort,
    CxxUShort,
    CxxInt,
    CxxUInt,
    CxxLong,
    CxxULong,
    CxxLongLong,
    CxxULongLong,
    SmartPointer

function Base.getproperty(x::Union{Contract, SmartPointer{Contract}}, name::Symbol)
    Base.@_inline_meta
    return if name === :conId
            Contract_get_conId(x)
        elseif name === :comboLegs
            Contract_get_comboLegs(x)
        elseif name === :comboLegsDescrip
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_comboLegsDescrip(x))
        elseif name === :secId
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_secId(x))
        elseif name === :secIdType
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_secIdType(x))
        elseif name === :includeExpired
            Contract_get_includeExpired(x)
        elseif name === :tradingClass
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_tradingClass(x))
        elseif name === :localSymbol
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_localSymbol(x))
        elseif name === :currency
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_currency(x))
        elseif name === :primaryExchange
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_primaryExchange(x))
        elseif name === :exchange
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_exchange(x))
        elseif name === :multiplier
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_multiplier(x))
        elseif name === :right
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_right(x))
        elseif name === :strike
            Contract_get_strike(x)
        elseif name === :lastTradeDateOrContractMonth
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_lastTradeDateOrContractMonth(x))
        elseif name === :secType
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_secType(x))
        elseif name === :symbol
            CxxWrap.CxxWrapCore.dereference_argument(Contract_get_symbol(x))
        else
            (Base).getfield(x, name)
        end
end
function Base.setproperty!(x::Union{Contract, SmartPointer{Contract}}, name::Symbol, value)
    Base.@_inline_meta
    if name === :conId
        Contract_set_conId(x, value)
    elseif name === :comboLegsDescrip
        Contract_set_comboLegsDescrip(x, value)
    elseif name === :secId
        Contract_set_secId(x, value)
    elseif name === :secIdType
        Contract_set_secIdType(x, value)
    elseif name === :includeExpired
        Contract_set_includeExpired(x, value)
    elseif name === :tradingClass
        Contract_set_tradingClass(x, value)
    elseif name === :localSymbol
        Contract_set_localSymbol(x, value)
    elseif name === :currency
        Contract_set_currency(x, value)
    elseif name === :primaryExchange
        Contract_set_primaryExchange(x, value)
    elseif name === :exchange
        Contract_set_exchange(x, value)
    elseif name === :multiplier
        Contract_set_multiplier(x, value)
    elseif name === :right
        Contract_set_right(x, value)
    elseif name === :strike
        Contract_set_strike(x, value)
    elseif name === :lastTradeDateOrContractMonth
        Contract_set_lastTradeDateOrContractMonth(x, value)
    elseif name === :secType
        Contract_set_secType(x, value)
    elseif name === :symbol
        Contract_set_symbol(x, value)
    else
        (Base).setfield!(x, name, value)
    end
    return x
end
function Base.propertynames(x::Union{Contract, SmartPointer{Contract}})
    Base.@_inline_meta
    return (:conId, :symbol, :secType, :lastTradeDateOrContractMonth, :strike, :right, :multiplier, :exchange, :primaryExchange, :currency, :localSymbol, :tradingClass, :includeExpired, :secIdType, :secId, :comboLegsDescrip, :comboLegs)
end
