// Copyright (C) 2010-2016  MarketFactory, Inc. All Rights Reserved.
//================================================================================
//   This file is auto-generated; DO NOT EDIT!
//================================================================================

#include <API/Clients/CPP/Proto/SubscriptionEvent.h>
#include <API/Clients/CPP/MFAPIClient/APIPrivate.h>

namespace MFAPI {

SubscriptionEvent::SubscriptionEvent()
{
}

SubscriptionEvent::~SubscriptionEvent()
{
}

void SubscriptionEvent::read(void* v)
{
    FastCodec* in = static_cast<FastCodec*>(v);
    (void)in;

    sub.read(v);
    clSubID = in->read_string();
    status = SubscriptionStatus::Type(in->read_uint8());
    reason = in->read_string();
    sticky = in->read_bool();

}

void SubscriptionEvent::write(void* v) const
{
    FastCodec* out = static_cast<FastCodec*>(v);
    (void)out;

    sub.write(v);
    out->write_string(clSubID);
    out->write_uint8(status); /* enum SubscriptionStatus */
    out->write_string(reason);
    out->write_bool(sticky);

}

bool SubscriptionEvent::operator!=(const SubscriptionEvent& o) const
{
    if(this == &o)
    {
        return false;
    }
    if(sub != o.sub) return true;
    if(clSubID != o.clSubID) return true;
    if(status != o.status) return true;
    if(reason != o.reason) return true;
    if(sticky != o.sticky) return true;

    return false;
}

bool SubscriptionEvent::operator==(const SubscriptionEvent& o) const
{
    return !operator!=(o);
}

bool SubscriptionEvent::operator<(const SubscriptionEvent& o) const
{
    if(this == &o)
    {
        return false;
    }
    if(sub < o.sub) return true;
    else if(o.sub < sub) return false;
    if(clSubID < o.clSubID) return true;
    else if(o.clSubID < clSubID) return false;
    if(status < o.status) return true;
    else if(o.status < status) return false;
    if(reason < o.reason) return true;
    else if(o.reason < reason) return false;
    if(sticky < o.sticky) return true;
    else if(o.sticky < sticky) return false;

    return false;
}

std::ostream& operator<<(std::ostream& os, const SubscriptionEvent& o)
{
    o.dump(os, false);
    return os;
}

void SubscriptionEvent::dump(std::ostream& os, bool pretty) const
{
    TextStream sos;
    TextCodec codec(sos);
    TextWriter wr(codec, true);
    sos << "<SubscriptionEvent ";
    dump(&wr);
    sos << ">";
    os.write(sos.ends(), sos.size());
}

void SubscriptionEvent::dump(void* v) const
{
    TextWriter* wr = static_cast<TextWriter*>(v);
    TextCodec* out = &wr->out();
    (void)wr;

    TextWriter::State __state = wr->push("(", false);
    wr->newfield();
    out->write_data("sub=");
    this->sub.dump(v);
    wr->newfield();
    out->write_data("clSubID=");
    out->write_string(this->clSubID);
    wr->newfield();
    out->write_data("status=");
    out->write_rawfield(SubscriptionStatus::toString(this->status)); /* enum SubscriptionStatus */
    wr->newfield();
    out->write_data("reason=");
    out->write_string(this->reason);
    wr->newfield();
    out->write_data("sticky=");
    out->write_bool(this->sticky);

    wr->pop(")", __state);
}

} // MFAPI

/*
Brought to you by
/opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3/Messaging/main.py --root /opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3 --commit-date 2016-12-06T18:11:31.205-05:00 --revision 19c07f7ab2ea0612a19fbcabdd4a54e242830e7d --branch master --generated_directory /opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3/build/rh7_3.13.0/release/intel64/generated/Python -o /opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3/build/rh7_3.13.0/release/intel64/generated/API/Clients/CPP/Proto -i /opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3/Messaging/MFProtocol --namespace=MFAPI cppapi /opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3/Messaging/MFProtocol.proto.3130 /opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3/Messaging/MFObsolete.proto.3130 
*/
