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

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

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

// FromMessage creates a ListExecute from a quickfix.Message instance.
func FromMessage(m *quickfix.Message) ListExecute {
	return ListExecute{
		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 ListExecute) ToMessage() *quickfix.Message {
	return m.Message
}

// New returns a ListExecute initialized with the required fields for ListExecute.
func New(listid field.ListIDField) (m ListExecute) {
	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("L"))
	m.Set(listid)

	return
}

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

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

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

// SetWaveNo sets WaveNo, Tag 105.
func (m ListExecute) SetWaveNo(v string) {
	m.Set(field.NewWaveNo(v))
}

// GetText gets Text, Tag 58.
func (m ListExecute) 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 ListExecute) GetListID() (v string, err quickfix.MessageRejectError) {
	var f field.ListIDField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetWaveNo gets WaveNo, Tag 105.
func (m ListExecute) GetWaveNo() (v string, err quickfix.MessageRejectError) {
	var f field.WaveNoField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

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

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

// HasWaveNo returns true if WaveNo is present, Tag 105.
func (m ListExecute) HasWaveNo() bool {
	return m.Has(tag.WaveNo)
}
