// This file is generated by TypeBuilder_h.template.

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef content_protocol_SmartCardEmulation_h
#define content_protocol_SmartCardEmulation_h

#include "content/common/content_export.h"
#include "content/browser/devtools/protocol/protocol.h"
// For each imported domain we generate a ValueConversions struct instead of a full domain definition
// and include Domain::API version from there.

namespace content {
namespace protocol {
namespace SmartCardEmulation {
using ResultCode = String;
using ShareMode = String;
using Disposition = String;
using ConnectionState = String;
class ReaderStateFlags;
class ProtocolSet;
using Protocol = String;
class ReaderStateIn;
class ReaderStateOut;

// ------------- Forward and enum declarations.

namespace ResultCodeEnum {
inline constexpr char Success[] = "success";
inline constexpr char RemovedCard[] = "removed-card";
inline constexpr char ResetCard[] = "reset-card";
inline constexpr char UnpoweredCard[] = "unpowered-card";
inline constexpr char UnresponsiveCard[] = "unresponsive-card";
inline constexpr char UnsupportedCard[] = "unsupported-card";
inline constexpr char ReaderUnavailable[] = "reader-unavailable";
inline constexpr char SharingViolation[] = "sharing-violation";
inline constexpr char NotTransacted[] = "not-transacted";
inline constexpr char NoSmartcard[] = "no-smartcard";
inline constexpr char ProtoMismatch[] = "proto-mismatch";
inline constexpr char SystemCancelled[] = "system-cancelled";
inline constexpr char NotReady[] = "not-ready";
inline constexpr char Cancelled[] = "cancelled";
inline constexpr char InsufficientBuffer[] = "insufficient-buffer";
inline constexpr char InvalidHandle[] = "invalid-handle";
inline constexpr char InvalidParameter[] = "invalid-parameter";
inline constexpr char InvalidValue[] = "invalid-value";
inline constexpr char NoMemory[] = "no-memory";
inline constexpr char Timeout[] = "timeout";
inline constexpr char UnknownReader[] = "unknown-reader";
inline constexpr char UnsupportedFeature[] = "unsupported-feature";
inline constexpr char NoReadersAvailable[] = "no-readers-available";
inline constexpr char ServiceStopped[] = "service-stopped";
inline constexpr char NoService[] = "no-service";
inline constexpr char CommError[] = "comm-error";
inline constexpr char InternalError[] = "internal-error";
inline constexpr char ServerTooBusy[] = "server-too-busy";
inline constexpr char Unexpected[] = "unexpected";
inline constexpr char Shutdown[] = "shutdown";
inline constexpr char UnknownCard[] = "unknown-card";
inline constexpr char Unknown[] = "unknown";
} // namespace ResultCodeEnum

namespace ShareModeEnum {
inline constexpr char Shared[] = "shared";
inline constexpr char Exclusive[] = "exclusive";
inline constexpr char Direct[] = "direct";
} // namespace ShareModeEnum

namespace DispositionEnum {
inline constexpr char LeaveCard[] = "leave-card";
inline constexpr char ResetCard[] = "reset-card";
inline constexpr char UnpowerCard[] = "unpower-card";
inline constexpr char EjectCard[] = "eject-card";
} // namespace DispositionEnum

namespace ConnectionStateEnum {
inline constexpr char Absent[] = "absent";
inline constexpr char Present[] = "present";
inline constexpr char Swallowed[] = "swallowed";
inline constexpr char Powered[] = "powered";
inline constexpr char Negotiable[] = "negotiable";
inline constexpr char Specific[] = "specific";
} // namespace ConnectionStateEnum

namespace ProtocolEnum {
inline constexpr char T0[] = "t0";
inline constexpr char T1[] = "t1";
inline constexpr char Raw[] = "raw";
} // namespace ProtocolEnum

// ------------- Type and builder declarations.

class CONTENT_EXPORT ReaderStateFlags : public ::crdtp::ProtocolObject<ReaderStateFlags> {
public:
    ~ReaderStateFlags() override;  // Defined below

    bool HasUnaware() { return !!m_unaware; }
    bool GetUnaware(bool defaultValue) const {
       return m_unaware.value_or(defaultValue);
    }
    const std::optional<bool>& GetUnaware() const {
       return m_unaware;
    }
    void SetUnaware(bool value);  // Defined below

    bool HasIgnore() { return !!m_ignore; }
    bool GetIgnore(bool defaultValue) const {
       return m_ignore.value_or(defaultValue);
    }
    const std::optional<bool>& GetIgnore() const {
       return m_ignore;
    }
    void SetIgnore(bool value);  // Defined below

    bool HasChanged() { return !!m_changed; }
    bool GetChanged(bool defaultValue) const {
       return m_changed.value_or(defaultValue);
    }
    const std::optional<bool>& GetChanged() const {
       return m_changed;
    }
    void SetChanged(bool value);  // Defined below

    bool HasUnknown() { return !!m_unknown; }
    bool GetUnknown(bool defaultValue) const {
       return m_unknown.value_or(defaultValue);
    }
    const std::optional<bool>& GetUnknown() const {
       return m_unknown;
    }
    void SetUnknown(bool value);  // Defined below

    bool HasUnavailable() { return !!m_unavailable; }
    bool GetUnavailable(bool defaultValue) const {
       return m_unavailable.value_or(defaultValue);
    }
    const std::optional<bool>& GetUnavailable() const {
       return m_unavailable;
    }
    void SetUnavailable(bool value);  // Defined below

    bool HasEmpty() { return !!m_empty; }
    bool GetEmpty(bool defaultValue) const {
       return m_empty.value_or(defaultValue);
    }
    const std::optional<bool>& GetEmpty() const {
       return m_empty;
    }
    void SetEmpty(bool value);  // Defined below

    bool HasPresent() { return !!m_present; }
    bool GetPresent(bool defaultValue) const {
       return m_present.value_or(defaultValue);
    }
    const std::optional<bool>& GetPresent() const {
       return m_present;
    }
    void SetPresent(bool value);  // Defined below

    bool HasExclusive() { return !!m_exclusive; }
    bool GetExclusive(bool defaultValue) const {
       return m_exclusive.value_or(defaultValue);
    }
    const std::optional<bool>& GetExclusive() const {
       return m_exclusive;
    }
    void SetExclusive(bool value);  // Defined below

    bool HasInuse() { return !!m_inuse; }
    bool GetInuse(bool defaultValue) const {
       return m_inuse.value_or(defaultValue);
    }
    const std::optional<bool>& GetInuse() const {
       return m_inuse;
    }
    void SetInuse(bool value);  // Defined below

    bool HasMute() { return !!m_mute; }
    bool GetMute(bool defaultValue) const {
       return m_mute.value_or(defaultValue);
    }
    const std::optional<bool>& GetMute() const {
       return m_mute;
    }
    void SetMute(bool value);  // Defined below

    bool HasUnpowered() { return !!m_unpowered; }
    bool GetUnpowered(bool defaultValue) const {
       return m_unpowered.value_or(defaultValue);
    }
    const std::optional<bool>& GetUnpowered() const {
       return m_unpowered;
    }
    void SetUnpowered(bool value);  // Defined below

    template<int STATE>
    class ReaderStateFlagsBuilder {
    public:
        enum {
            NoFieldsSet = 0,
            AllFieldsSet = (0)};


        ReaderStateFlagsBuilder<STATE>& SetUnaware(bool value);  // Defined below

        ReaderStateFlagsBuilder<STATE>& SetIgnore(bool value);  // Defined below

        ReaderStateFlagsBuilder<STATE>& SetChanged(bool value);  // Defined below

        ReaderStateFlagsBuilder<STATE>& SetUnknown(bool value);  // Defined below

        ReaderStateFlagsBuilder<STATE>& SetUnavailable(bool value);  // Defined below

        ReaderStateFlagsBuilder<STATE>& SetEmpty(bool value);  // Defined below

        ReaderStateFlagsBuilder<STATE>& SetPresent(bool value);  // Defined below

        ReaderStateFlagsBuilder<STATE>& SetExclusive(bool value);  // Defined below

        ReaderStateFlagsBuilder<STATE>& SetInuse(bool value);  // Defined below

        ReaderStateFlagsBuilder<STATE>& SetMute(bool value);  // Defined below

        ReaderStateFlagsBuilder<STATE>& SetUnpowered(bool value);  // Defined below

        std::unique_ptr<ReaderStateFlags> Build()
        {
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
            return std::move(m_result);
        }

    private:
        friend class ReaderStateFlags;
        ReaderStateFlagsBuilder() : m_result(new ReaderStateFlags()) { }

        template<int STEP> ReaderStateFlagsBuilder<STATE | STEP>& castState()
        {
            return *reinterpret_cast<ReaderStateFlagsBuilder<STATE | STEP>*>(this);
        }

        std::unique_ptr<protocol::SmartCardEmulation::ReaderStateFlags> m_result;
    };

    static ReaderStateFlagsBuilder<0> Create()
    {
        return ReaderStateFlagsBuilder<0>();
    }

private:
    DECLARE_SERIALIZATION_SUPPORT();

    ReaderStateFlags();  // Defined below

    std::optional<bool> m_unaware;
    std::optional<bool> m_ignore;
    std::optional<bool> m_changed;
    std::optional<bool> m_unknown;
    std::optional<bool> m_unavailable;
    std::optional<bool> m_empty;
    std::optional<bool> m_present;
    std::optional<bool> m_exclusive;
    std::optional<bool> m_inuse;
    std::optional<bool> m_mute;
    std::optional<bool> m_unpowered;
};


class CONTENT_EXPORT ProtocolSet : public ::crdtp::ProtocolObject<ProtocolSet> {
public:
    ~ProtocolSet() override;  // Defined below

    bool HasT0() { return !!m_t0; }
    bool GetT0(bool defaultValue) const {
       return m_t0.value_or(defaultValue);
    }
    const std::optional<bool>& GetT0() const {
       return m_t0;
    }
    void SetT0(bool value);  // Defined below

    bool HasT1() { return !!m_t1; }
    bool GetT1(bool defaultValue) const {
       return m_t1.value_or(defaultValue);
    }
    const std::optional<bool>& GetT1() const {
       return m_t1;
    }
    void SetT1(bool value);  // Defined below

    bool HasRaw() { return !!m_raw; }
    bool GetRaw(bool defaultValue) const {
       return m_raw.value_or(defaultValue);
    }
    const std::optional<bool>& GetRaw() const {
       return m_raw;
    }
    void SetRaw(bool value);  // Defined below

    template<int STATE>
    class ProtocolSetBuilder {
    public:
        enum {
            NoFieldsSet = 0,
            AllFieldsSet = (0)};


        ProtocolSetBuilder<STATE>& SetT0(bool value);  // Defined below

        ProtocolSetBuilder<STATE>& SetT1(bool value);  // Defined below

        ProtocolSetBuilder<STATE>& SetRaw(bool value);  // Defined below

        std::unique_ptr<ProtocolSet> Build()
        {
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
            return std::move(m_result);
        }

    private:
        friend class ProtocolSet;
        ProtocolSetBuilder() : m_result(new ProtocolSet()) { }

        template<int STEP> ProtocolSetBuilder<STATE | STEP>& castState()
        {
            return *reinterpret_cast<ProtocolSetBuilder<STATE | STEP>*>(this);
        }

        std::unique_ptr<protocol::SmartCardEmulation::ProtocolSet> m_result;
    };

    static ProtocolSetBuilder<0> Create()
    {
        return ProtocolSetBuilder<0>();
    }

private:
    DECLARE_SERIALIZATION_SUPPORT();

    ProtocolSet();  // Defined below

    std::optional<bool> m_t0;
    std::optional<bool> m_t1;
    std::optional<bool> m_raw;
};


class CONTENT_EXPORT ReaderStateIn : public ::crdtp::ProtocolObject<ReaderStateIn> {
public:
    ~ReaderStateIn() override;  // Defined below

    String GetReader() { return m_reader; }
    void SetReader(const String& value);  // Defined below

    protocol::SmartCardEmulation::ReaderStateFlags* GetCurrentState() { return m_currentState.get(); }
    void SetCurrentState(std::unique_ptr<protocol::SmartCardEmulation::ReaderStateFlags> value);  // Defined below

    int GetCurrentInsertionCount() { return m_currentInsertionCount; }
    void SetCurrentInsertionCount(int value);  // Defined below

    template<int STATE>
    class ReaderStateInBuilder {
    public:
        enum {
            NoFieldsSet = 0,
            ReaderSet = 1 << 1,
            CurrentStateSet = 1 << 2,
            CurrentInsertionCountSet = 1 << 3,
            AllFieldsSet = (ReaderSet | CurrentStateSet | CurrentInsertionCountSet | 0)};


        ReaderStateInBuilder<STATE | ReaderSet>& SetReader(const String& value);  // Defined below

        ReaderStateInBuilder<STATE | CurrentStateSet>& SetCurrentState(std::unique_ptr<protocol::SmartCardEmulation::ReaderStateFlags> value);  // Defined below

        ReaderStateInBuilder<STATE | CurrentInsertionCountSet>& SetCurrentInsertionCount(int value);  // Defined below

        std::unique_ptr<ReaderStateIn> Build()
        {
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
            return std::move(m_result);
        }

    private:
        friend class ReaderStateIn;
        ReaderStateInBuilder() : m_result(new ReaderStateIn()) { }

        template<int STEP> ReaderStateInBuilder<STATE | STEP>& castState()
        {
            return *reinterpret_cast<ReaderStateInBuilder<STATE | STEP>*>(this);
        }

        std::unique_ptr<protocol::SmartCardEmulation::ReaderStateIn> m_result;
    };

    static ReaderStateInBuilder<0> Create()
    {
        return ReaderStateInBuilder<0>();
    }

private:
    DECLARE_SERIALIZATION_SUPPORT();

    ReaderStateIn();  // Defined below

    String m_reader;
    std::unique_ptr<protocol::SmartCardEmulation::ReaderStateFlags> m_currentState;
    int m_currentInsertionCount;
};


class CONTENT_EXPORT ReaderStateOut : public ::crdtp::ProtocolObject<ReaderStateOut> {
public:
    ~ReaderStateOut() override;  // Defined below

    String GetReader() { return m_reader; }
    void SetReader(const String& value);  // Defined below

    protocol::SmartCardEmulation::ReaderStateFlags* GetEventState() { return m_eventState.get(); }
    void SetEventState(std::unique_ptr<protocol::SmartCardEmulation::ReaderStateFlags> value);  // Defined below

    int GetEventCount() { return m_eventCount; }
    void SetEventCount(int value);  // Defined below

    Binary GetAtr() { return m_atr; }
    void SetAtr(const Binary& value);  // Defined below

    template<int STATE>
    class ReaderStateOutBuilder {
    public:
        enum {
            NoFieldsSet = 0,
            ReaderSet = 1 << 1,
            EventStateSet = 1 << 2,
            EventCountSet = 1 << 3,
            AtrSet = 1 << 4,
            AllFieldsSet = (ReaderSet | EventStateSet | EventCountSet | AtrSet | 0)};


        ReaderStateOutBuilder<STATE | ReaderSet>& SetReader(const String& value);  // Defined below

        ReaderStateOutBuilder<STATE | EventStateSet>& SetEventState(std::unique_ptr<protocol::SmartCardEmulation::ReaderStateFlags> value);  // Defined below

        ReaderStateOutBuilder<STATE | EventCountSet>& SetEventCount(int value);  // Defined below

        ReaderStateOutBuilder<STATE | AtrSet>& SetAtr(const Binary& value);  // Defined below

        std::unique_ptr<ReaderStateOut> Build()
        {
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
            return std::move(m_result);
        }

    private:
        friend class ReaderStateOut;
        ReaderStateOutBuilder() : m_result(new ReaderStateOut()) { }

        template<int STEP> ReaderStateOutBuilder<STATE | STEP>& castState()
        {
            return *reinterpret_cast<ReaderStateOutBuilder<STATE | STEP>*>(this);
        }

        std::unique_ptr<protocol::SmartCardEmulation::ReaderStateOut> m_result;
    };

    static ReaderStateOutBuilder<0> Create()
    {
        return ReaderStateOutBuilder<0>();
    }

private:
    DECLARE_SERIALIZATION_SUPPORT();

    ReaderStateOut();  // Defined below

    String m_reader;
    std::unique_ptr<protocol::SmartCardEmulation::ReaderStateFlags> m_eventState;
    int m_eventCount;
    Binary m_atr;
};


// ------------- Type and builder method definitions.
//
// These methods separate from the type declaration because of
// https://github.com/llvm/llvm-project/issues/59966. The DevTools protocol has
// mutually recursive types, so we cannot simply reorder the types.
inline ReaderStateFlags::~ReaderStateFlags() = default;
inline void ReaderStateFlags::SetUnaware(bool value) { m_unaware = value; }
inline void ReaderStateFlags::SetIgnore(bool value) { m_ignore = value; }
inline void ReaderStateFlags::SetChanged(bool value) { m_changed = value; }
inline void ReaderStateFlags::SetUnknown(bool value) { m_unknown = value; }
inline void ReaderStateFlags::SetUnavailable(bool value) { m_unavailable = value; }
inline void ReaderStateFlags::SetEmpty(bool value) { m_empty = value; }
inline void ReaderStateFlags::SetPresent(bool value) { m_present = value; }
inline void ReaderStateFlags::SetExclusive(bool value) { m_exclusive = value; }
inline void ReaderStateFlags::SetInuse(bool value) { m_inuse = value; }
inline void ReaderStateFlags::SetMute(bool value) { m_mute = value; }
inline void ReaderStateFlags::SetUnpowered(bool value) { m_unpowered = value; }

template<int STATE>
inline ReaderStateFlags::ReaderStateFlagsBuilder<STATE>& ReaderStateFlags::ReaderStateFlagsBuilder<STATE>::SetUnaware(bool value) {
  m_result->SetUnaware(value);
  return *this;
}
template<int STATE>
inline ReaderStateFlags::ReaderStateFlagsBuilder<STATE>& ReaderStateFlags::ReaderStateFlagsBuilder<STATE>::SetIgnore(bool value) {
  m_result->SetIgnore(value);
  return *this;
}
template<int STATE>
inline ReaderStateFlags::ReaderStateFlagsBuilder<STATE>& ReaderStateFlags::ReaderStateFlagsBuilder<STATE>::SetChanged(bool value) {
  m_result->SetChanged(value);
  return *this;
}
template<int STATE>
inline ReaderStateFlags::ReaderStateFlagsBuilder<STATE>& ReaderStateFlags::ReaderStateFlagsBuilder<STATE>::SetUnknown(bool value) {
  m_result->SetUnknown(value);
  return *this;
}
template<int STATE>
inline ReaderStateFlags::ReaderStateFlagsBuilder<STATE>& ReaderStateFlags::ReaderStateFlagsBuilder<STATE>::SetUnavailable(bool value) {
  m_result->SetUnavailable(value);
  return *this;
}
template<int STATE>
inline ReaderStateFlags::ReaderStateFlagsBuilder<STATE>& ReaderStateFlags::ReaderStateFlagsBuilder<STATE>::SetEmpty(bool value) {
  m_result->SetEmpty(value);
  return *this;
}
template<int STATE>
inline ReaderStateFlags::ReaderStateFlagsBuilder<STATE>& ReaderStateFlags::ReaderStateFlagsBuilder<STATE>::SetPresent(bool value) {
  m_result->SetPresent(value);
  return *this;
}
template<int STATE>
inline ReaderStateFlags::ReaderStateFlagsBuilder<STATE>& ReaderStateFlags::ReaderStateFlagsBuilder<STATE>::SetExclusive(bool value) {
  m_result->SetExclusive(value);
  return *this;
}
template<int STATE>
inline ReaderStateFlags::ReaderStateFlagsBuilder<STATE>& ReaderStateFlags::ReaderStateFlagsBuilder<STATE>::SetInuse(bool value) {
  m_result->SetInuse(value);
  return *this;
}
template<int STATE>
inline ReaderStateFlags::ReaderStateFlagsBuilder<STATE>& ReaderStateFlags::ReaderStateFlagsBuilder<STATE>::SetMute(bool value) {
  m_result->SetMute(value);
  return *this;
}
template<int STATE>
inline ReaderStateFlags::ReaderStateFlagsBuilder<STATE>& ReaderStateFlags::ReaderStateFlagsBuilder<STATE>::SetUnpowered(bool value) {
  m_result->SetUnpowered(value);
  return *this;
}

inline ReaderStateFlags::ReaderStateFlags() {
}
inline ProtocolSet::~ProtocolSet() = default;
inline void ProtocolSet::SetT0(bool value) { m_t0 = value; }
inline void ProtocolSet::SetT1(bool value) { m_t1 = value; }
inline void ProtocolSet::SetRaw(bool value) { m_raw = value; }

template<int STATE>
inline ProtocolSet::ProtocolSetBuilder<STATE>& ProtocolSet::ProtocolSetBuilder<STATE>::SetT0(bool value) {
  m_result->SetT0(value);
  return *this;
}
template<int STATE>
inline ProtocolSet::ProtocolSetBuilder<STATE>& ProtocolSet::ProtocolSetBuilder<STATE>::SetT1(bool value) {
  m_result->SetT1(value);
  return *this;
}
template<int STATE>
inline ProtocolSet::ProtocolSetBuilder<STATE>& ProtocolSet::ProtocolSetBuilder<STATE>::SetRaw(bool value) {
  m_result->SetRaw(value);
  return *this;
}

inline ProtocolSet::ProtocolSet() {
}
inline ReaderStateIn::~ReaderStateIn() = default;
inline void ReaderStateIn::SetReader(const String& value) { m_reader = value; }
inline void ReaderStateIn::SetCurrentState(std::unique_ptr<protocol::SmartCardEmulation::ReaderStateFlags> value) { m_currentState = std::move(value); }
inline void ReaderStateIn::SetCurrentInsertionCount(int value) { m_currentInsertionCount = value; }

template<int STATE>
inline ReaderStateIn::ReaderStateInBuilder<STATE | ReaderStateIn::ReaderStateInBuilder<STATE>::ReaderSet>&
ReaderStateIn::ReaderStateInBuilder<STATE>::SetReader(const String& value) {
  static_assert(!(STATE & ReaderSet), "property reader should not be set yet");
  m_result->SetReader(value);
  return castState<ReaderSet>();
}
template<int STATE>
inline ReaderStateIn::ReaderStateInBuilder<STATE | ReaderStateIn::ReaderStateInBuilder<STATE>::CurrentStateSet>&
ReaderStateIn::ReaderStateInBuilder<STATE>::SetCurrentState(std::unique_ptr<protocol::SmartCardEmulation::ReaderStateFlags> value) {
  static_assert(!(STATE & CurrentStateSet), "property currentState should not be set yet");
  m_result->SetCurrentState(std::move(value));
  return castState<CurrentStateSet>();
}
template<int STATE>
inline ReaderStateIn::ReaderStateInBuilder<STATE | ReaderStateIn::ReaderStateInBuilder<STATE>::CurrentInsertionCountSet>&
ReaderStateIn::ReaderStateInBuilder<STATE>::SetCurrentInsertionCount(int value) {
  static_assert(!(STATE & CurrentInsertionCountSet), "property currentInsertionCount should not be set yet");
  m_result->SetCurrentInsertionCount(value);
  return castState<CurrentInsertionCountSet>();
}

inline ReaderStateIn::ReaderStateIn() {
  m_currentInsertionCount = 0;
}
inline ReaderStateOut::~ReaderStateOut() = default;
inline void ReaderStateOut::SetReader(const String& value) { m_reader = value; }
inline void ReaderStateOut::SetEventState(std::unique_ptr<protocol::SmartCardEmulation::ReaderStateFlags> value) { m_eventState = std::move(value); }
inline void ReaderStateOut::SetEventCount(int value) { m_eventCount = value; }
inline void ReaderStateOut::SetAtr(const Binary& value) { m_atr = value; }

template<int STATE>
inline ReaderStateOut::ReaderStateOutBuilder<STATE | ReaderStateOut::ReaderStateOutBuilder<STATE>::ReaderSet>&
ReaderStateOut::ReaderStateOutBuilder<STATE>::SetReader(const String& value) {
  static_assert(!(STATE & ReaderSet), "property reader should not be set yet");
  m_result->SetReader(value);
  return castState<ReaderSet>();
}
template<int STATE>
inline ReaderStateOut::ReaderStateOutBuilder<STATE | ReaderStateOut::ReaderStateOutBuilder<STATE>::EventStateSet>&
ReaderStateOut::ReaderStateOutBuilder<STATE>::SetEventState(std::unique_ptr<protocol::SmartCardEmulation::ReaderStateFlags> value) {
  static_assert(!(STATE & EventStateSet), "property eventState should not be set yet");
  m_result->SetEventState(std::move(value));
  return castState<EventStateSet>();
}
template<int STATE>
inline ReaderStateOut::ReaderStateOutBuilder<STATE | ReaderStateOut::ReaderStateOutBuilder<STATE>::EventCountSet>&
ReaderStateOut::ReaderStateOutBuilder<STATE>::SetEventCount(int value) {
  static_assert(!(STATE & EventCountSet), "property eventCount should not be set yet");
  m_result->SetEventCount(value);
  return castState<EventCountSet>();
}
template<int STATE>
inline ReaderStateOut::ReaderStateOutBuilder<STATE | ReaderStateOut::ReaderStateOutBuilder<STATE>::AtrSet>&
ReaderStateOut::ReaderStateOutBuilder<STATE>::SetAtr(const Binary& value) {
  static_assert(!(STATE & AtrSet), "property atr should not be set yet");
  m_result->SetAtr(value);
  return castState<AtrSet>();
}

inline ReaderStateOut::ReaderStateOut() {
  m_eventCount = 0;
}

// ------------- Backend interface.

class CONTENT_EXPORT Backend {
public:
    virtual ~Backend() { }

    virtual DispatchResponse Enable() = 0;
    virtual DispatchResponse Disable() = 0;
    virtual DispatchResponse ReportEstablishContextResult(const String& in_requestId, int in_contextId) = 0;
    virtual DispatchResponse ReportReleaseContextResult(const String& in_requestId) = 0;
    virtual DispatchResponse ReportListReadersResult(const String& in_requestId, std::unique_ptr<protocol::Array<String>> in_readers) = 0;
    virtual DispatchResponse ReportGetStatusChangeResult(const String& in_requestId, std::unique_ptr<protocol::Array<protocol::SmartCardEmulation::ReaderStateOut>> in_readerStates) = 0;
    virtual DispatchResponse ReportBeginTransactionResult(const String& in_requestId, int in_handle) = 0;
    virtual DispatchResponse ReportPlainResult(const String& in_requestId) = 0;
    virtual DispatchResponse ReportConnectResult(const String& in_requestId, int in_handle, std::optional<String> in_activeProtocol) = 0;
    virtual DispatchResponse ReportDataResult(const String& in_requestId, const Binary& in_data) = 0;
    virtual DispatchResponse ReportStatusResult(const String& in_requestId, const String& in_readerName, const String& in_state, const Binary& in_atr, std::optional<String> in_protocol) = 0;
    virtual DispatchResponse ReportError(const String& in_requestId, const String& in_resultCode) = 0;

};

// ------------- Frontend interface.

class CONTENT_EXPORT Frontend {
public:
  explicit Frontend(FrontendChannel* frontend_channel) : frontend_channel_(frontend_channel) {}
    void EstablishContextRequested(const String& requestId);
    void ReleaseContextRequested(const String& requestId, int contextId);
    void ListReadersRequested(const String& requestId, int contextId);
    void GetStatusChangeRequested(const String& requestId, int contextId, std::unique_ptr<protocol::Array<protocol::SmartCardEmulation::ReaderStateIn>> readerStates, std::optional<int> timeout = {});
    void CancelRequested(const String& requestId, int contextId);
    void ConnectRequested(const String& requestId, int contextId, const String& reader, const String& shareMode, std::unique_ptr<protocol::SmartCardEmulation::ProtocolSet> preferredProtocols);
    void DisconnectRequested(const String& requestId, int handle, const String& disposition);
    void TransmitRequested(const String& requestId, int handle, const Binary& data, std::optional<String> protocol = {});
    void ControlRequested(const String& requestId, int handle, int controlCode, const Binary& data);
    void GetAttribRequested(const String& requestId, int handle, int attribId);
    void SetAttribRequested(const String& requestId, int handle, int attribId, const Binary& data);
    void StatusRequested(const String& requestId, int handle);
    void BeginTransactionRequested(const String& requestId, int handle);
    void EndTransactionRequested(const String& requestId, int handle, const String& disposition);

  void flush();
  void sendRawNotification(std::unique_ptr<Serializable>);
 private:
  FrontendChannel* frontend_channel_;
};

// ------------- Dispatcher.

class CONTENT_EXPORT Dispatcher {
public:
    static void wire(UberDispatcher*, Backend*);

private:
    Dispatcher() { }
};

// ------------- Metainfo.

class CONTENT_EXPORT Metainfo {
public:
    using BackendClass = Backend;
    using FrontendClass = Frontend;
    using DispatcherClass = Dispatcher;
    static const char domainName[];
    static const char commandPrefix[];
    static const char version[];
};

} // namespace SmartCardEmulation
} // namespace content
} // namespace protocol

#endif // !defined(content_protocol_SmartCardEmulation_h)
