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

import (
	"time"

	"github.com/shopspring/decimal"

	"quantex.com/qfixdpl/quickfix"
	"quantex.com/qfixdpl/quickfix/gen/enum"
	"quantex.com/qfixdpl/quickfix/gen/field"
	"quantex.com/qfixdpl/quickfix/gen/fixt11"
	"quantex.com/qfixdpl/quickfix/gen/tag"
)

// ExecutionAck is the fix50sp2 ExecutionAck type, MsgType = BN.
type ExecutionAck struct {
	fixt11.Header
	*quickfix.Body
	fixt11.Trailer
	Message *quickfix.Message
}

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

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

// New returns a ExecutionAck initialized with the required fields for ExecutionAck.
func New(orderid field.OrderIDField, execid field.ExecIDField, execackstatus field.ExecAckStatusField) (m ExecutionAck) {
	m.Message = quickfix.NewMessage()
	m.Header = fixt11.NewHeader(&m.Message.Header)
	m.Body = &m.Message.Body
	m.Trailer.Trailer = &m.Message.Trailer

	m.Header.Set(field.NewMsgType("BN"))
	m.Set(orderid)
	m.Set(execid)
	m.Set(execackstatus)

	return
}

// A RouteOut is the callback type that should be implemented for routing Message.
type RouteOut func(msg ExecutionAck, 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 "9", "BN", r
}

// SetAvgPx sets AvgPx, Tag 6.
func (m ExecutionAck) SetAvgPx(value decimal.Decimal, scale int32) {
	m.Set(field.NewAvgPx(value, scale))
}

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

// SetCumQty sets CumQty, Tag 14.
func (m ExecutionAck) SetCumQty(value decimal.Decimal, scale int32) {
	m.Set(field.NewCumQty(value, scale))
}

// SetExecID sets ExecID, Tag 17.
func (m ExecutionAck) SetExecID(v string) {
	m.Set(field.NewExecID(v))
}

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

// SetSymbol sets Symbol, Tag 55.
func (m ExecutionAck) SetSymbol(v string) {
	m.Set(field.NewSymbol(v))
}

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

// SetTransactTime sets TransactTime, Tag 60.
func (m ExecutionAck) SetTransactTime(v time.Time) {
	m.Set(field.NewTransactTime(v))
}

// SetDKReason sets DKReason, Tag 127.
func (m ExecutionAck) SetDKReason(v enum.DKReason) {
	m.Set(field.NewDKReason(v))
}

// SetLeavesQty sets LeavesQty, Tag 151.
func (m ExecutionAck) SetLeavesQty(value decimal.Decimal, scale int32) {
	m.Set(field.NewLeavesQty(value, scale))
}

// SetExecAckStatus sets ExecAckStatus, Tag 1036.
func (m ExecutionAck) SetExecAckStatus(v enum.ExecAckStatus) {
	m.Set(field.NewExecAckStatus(v))
}

// SetOwnerTraderID sets OwnerTraderID, Tag 6153.
func (m ExecutionAck) SetOwnerTraderID(v string) {
	m.Set(field.NewOwnerTraderID(v))
}

// SetCoverPrice sets CoverPrice, Tag 20111.
func (m ExecutionAck) SetCoverPrice(value decimal.Decimal, scale int32) {
	m.Set(field.NewCoverPrice(value, scale))
}

// SetImpliedCoverProceeds sets ImpliedCoverProceeds, Tag 23671.
func (m ExecutionAck) SetImpliedCoverProceeds(value decimal.Decimal, scale int32) {
	m.Set(field.NewImpliedCoverProceeds(value, scale))
}

// GetAvgPx gets AvgPx, Tag 6.
func (m ExecutionAck) GetAvgPx() (v decimal.Decimal, err quickfix.MessageRejectError) {
	var f field.AvgPxField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

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

// GetCumQty gets CumQty, Tag 14.
func (m ExecutionAck) GetCumQty() (v decimal.Decimal, err quickfix.MessageRejectError) {
	var f field.CumQtyField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetExecID gets ExecID, Tag 17.
func (m ExecutionAck) GetExecID() (v string, err quickfix.MessageRejectError) {
	var f field.ExecIDField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

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

// GetSymbol gets Symbol, Tag 55.
func (m ExecutionAck) GetSymbol() (v string, err quickfix.MessageRejectError) {
	var f field.SymbolField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

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

// GetTransactTime gets TransactTime, Tag 60.
func (m ExecutionAck) GetTransactTime() (v time.Time, err quickfix.MessageRejectError) {
	var f field.TransactTimeField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetDKReason gets DKReason, Tag 127.
func (m ExecutionAck) GetDKReason() (v enum.DKReason, err quickfix.MessageRejectError) {
	var f field.DKReasonField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetLeavesQty gets LeavesQty, Tag 151.
func (m ExecutionAck) GetLeavesQty() (v decimal.Decimal, err quickfix.MessageRejectError) {
	var f field.LeavesQtyField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetExecAckStatus gets ExecAckStatus, Tag 1036.
func (m ExecutionAck) GetExecAckStatus() (v enum.ExecAckStatus, err quickfix.MessageRejectError) {
	var f field.ExecAckStatusField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetOwnerTraderID gets OwnerTraderID, Tag 6153.
func (m ExecutionAck) GetOwnerTraderID() (v string, err quickfix.MessageRejectError) {
	var f field.OwnerTraderIDField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetCoverPrice gets CoverPrice, Tag 20111.
func (m ExecutionAck) GetCoverPrice() (v decimal.Decimal, err quickfix.MessageRejectError) {
	var f field.CoverPriceField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetImpliedCoverProceeds gets ImpliedCoverProceeds, Tag 23671.
func (m ExecutionAck) GetImpliedCoverProceeds() (v decimal.Decimal, err quickfix.MessageRejectError) {
	var f field.ImpliedCoverProceedsField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// HasAvgPx returns true if AvgPx is present, Tag 6.
func (m ExecutionAck) HasAvgPx() bool {
	return m.Has(tag.AvgPx)
}

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

// HasCumQty returns true if CumQty is present, Tag 14.
func (m ExecutionAck) HasCumQty() bool {
	return m.Has(tag.CumQty)
}

// HasExecID returns true if ExecID is present, Tag 17.
func (m ExecutionAck) HasExecID() bool {
	return m.Has(tag.ExecID)
}

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

// HasSymbol returns true if Symbol is present, Tag 55.
func (m ExecutionAck) HasSymbol() bool {
	return m.Has(tag.Symbol)
}

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

// HasTransactTime returns true if TransactTime is present, Tag 60.
func (m ExecutionAck) HasTransactTime() bool {
	return m.Has(tag.TransactTime)
}

// HasDKReason returns true if DKReason is present, Tag 127.
func (m ExecutionAck) HasDKReason() bool {
	return m.Has(tag.DKReason)
}

// HasLeavesQty returns true if LeavesQty is present, Tag 151.
func (m ExecutionAck) HasLeavesQty() bool {
	return m.Has(tag.LeavesQty)
}

// HasExecAckStatus returns true if ExecAckStatus is present, Tag 1036.
func (m ExecutionAck) HasExecAckStatus() bool {
	return m.Has(tag.ExecAckStatus)
}

// HasOwnerTraderID returns true if OwnerTraderID is present, Tag 6153.
func (m ExecutionAck) HasOwnerTraderID() bool {
	return m.Has(tag.OwnerTraderID)
}

// HasCoverPrice returns true if CoverPrice is present, Tag 20111.
func (m ExecutionAck) HasCoverPrice() bool {
	return m.Has(tag.CoverPrice)
}

// HasImpliedCoverProceeds returns true if ImpliedCoverProceeds is present, Tag 23671.
func (m ExecutionAck) HasImpliedCoverProceeds() bool {
	return m.Has(tag.ImpliedCoverProceeds)
}
