// Code generated by quickfix. DO NOT EDIT.
package ordercancelreject

import (
	"quantex.com/qfixdpl/quickfix"
	"quantex.com/qfixdpl/quickfix/gen/enum"
	"quantex.com/qfixdpl/quickfix/gen/field"
	"quantex.com/qfixdpl/quickfix/gen/fix40"
	"quantex.com/qfixdpl/quickfix/gen/tag"
)

// OrderCancelReject is the fix40 OrderCancelReject type, MsgType = 9.
type OrderCancelReject struct {
	fix40.Header
	*quickfix.Body
	fix40.Trailer
	Message *quickfix.Message
}

// FromMessage creates a OrderCancelReject from a quickfix.Message instance.
func FromMessage(m *quickfix.Message) OrderCancelReject {
	return OrderCancelReject{
		Header:  fix40.Header{Header: &m.Header},
		Body:    &m.Body,
		Trailer: fix40.Trailer{Trailer: &m.Trailer},
		Message: m,
	}
}

// ToMessage returns a quickfix.Message instance.
func (m OrderCancelReject) ToMessage() *quickfix.Message {
	return m.Message
}

// New returns a OrderCancelReject initialized with the required fields for OrderCancelReject.
func New(orderid field.OrderIDField, clordid field.ClOrdIDField) (m OrderCancelReject) {
	m.Message = quickfix.NewMessage()
	m.Header = fix40.NewHeader(&m.Message.Header)
	m.Body = &m.Message.Body
	m.Trailer.Trailer = &m.Message.Trailer

	m.Header.Set(field.NewMsgType("9"))
	m.Set(orderid)
	m.Set(clordid)

	return
}

// A RouteOut is the callback type that should be implemented for routing Message.
type RouteOut func(msg OrderCancelReject, sessionID quickfix.SessionID) quickfix.MessageRejectError

// Route returns the beginstring, message type, and MessageRoute for this Message type.
func Route(router RouteOut) (string, string, quickfix.MessageRoute) {
	r := func(msg *quickfix.Message, sessionID quickfix.SessionID) quickfix.MessageRejectError {
		return router(FromMessage(msg), sessionID)
	}
	return "FIX.4.0", "9", r
}

// SetClOrdID sets ClOrdID, Tag 11.
func (m OrderCancelReject) SetClOrdID(v string) {
	m.Set(field.NewClOrdID(v))
}

// SetOrderID sets OrderID, Tag 37.
func (m OrderCancelReject) SetOrderID(v string) {
	m.Set(field.NewOrderID(v))
}

// SetText sets Text, Tag 58.
func (m OrderCancelReject) SetText(v string) {
	m.Set(field.NewText(v))
}

// SetListID sets ListID, Tag 66.
func (m OrderCancelReject) SetListID(v string) {
	m.Set(field.NewListID(v))
}

// SetExecBroker sets ExecBroker, Tag 76.
func (m OrderCancelReject) SetExecBroker(v string) {
	m.Set(field.NewExecBroker(v))
}

// SetCxlRejReason sets CxlRejReason, Tag 102.
func (m OrderCancelReject) SetCxlRejReason(v enum.CxlRejReason) {
	m.Set(field.NewCxlRejReason(v))
}

// SetClientID sets ClientID, Tag 109.
func (m OrderCancelReject) SetClientID(v string) {
	m.Set(field.NewClientID(v))
}

// GetClOrdID gets ClOrdID, Tag 11.
func (m OrderCancelReject) GetClOrdID() (v string, err quickfix.MessageRejectError) {
	var f field.ClOrdIDField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetOrderID gets OrderID, Tag 37.
func (m OrderCancelReject) GetOrderID() (v string, err quickfix.MessageRejectError) {
	var f field.OrderIDField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetText gets Text, Tag 58.
func (m OrderCancelReject) GetText() (v string, err quickfix.MessageRejectError) {
	var f field.TextField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetListID gets ListID, Tag 66.
func (m OrderCancelReject) GetListID() (v string, err quickfix.MessageRejectError) {
	var f field.ListIDField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetExecBroker gets ExecBroker, Tag 76.
func (m OrderCancelReject) GetExecBroker() (v string, err quickfix.MessageRejectError) {
	var f field.ExecBrokerField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetCxlRejReason gets CxlRejReason, Tag 102.
func (m OrderCancelReject) GetCxlRejReason() (v enum.CxlRejReason, err quickfix.MessageRejectError) {
	var f field.CxlRejReasonField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetClientID gets ClientID, Tag 109.
func (m OrderCancelReject) GetClientID() (v string, err quickfix.MessageRejectError) {
	var f field.ClientIDField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// HasClOrdID returns true if ClOrdID is present, Tag 11.
func (m OrderCancelReject) HasClOrdID() bool {
	return m.Has(tag.ClOrdID)
}

// HasOrderID returns true if OrderID is present, Tag 37.
func (m OrderCancelReject) HasOrderID() bool {
	return m.Has(tag.OrderID)
}

// HasText returns true if Text is present, Tag 58.
func (m OrderCancelReject) HasText() bool {
	return m.Has(tag.Text)
}

// HasListID returns true if ListID is present, Tag 66.
func (m OrderCancelReject) HasListID() bool {
	return m.Has(tag.ListID)
}

// HasExecBroker returns true if ExecBroker is present, Tag 76.
func (m OrderCancelReject) HasExecBroker() bool {
	return m.Has(tag.ExecBroker)
}

// HasCxlRejReason returns true if CxlRejReason is present, Tag 102.
func (m OrderCancelReject) HasCxlRejReason() bool {
	return m.Has(tag.CxlRejReason)
}

// HasClientID returns true if ClientID is present, Tag 109.
func (m OrderCancelReject) HasClientID() bool {
	return m.Has(tag.ClientID)
}
