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

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/fix41"
	"quantex.com/qfixdpl/quickfix/gen/tag"
)

// Advertisement is the fix41 Advertisement type, MsgType = 7.
type Advertisement struct {
	fix41.Header
	*quickfix.Body
	fix41.Trailer
	Message *quickfix.Message
}

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

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

// New returns a Advertisement initialized with the required fields for Advertisement.
func New(advid field.AdvIdField, advtranstype field.AdvTransTypeField, symbol field.SymbolField, advside field.AdvSideField, shares field.SharesField) (m Advertisement) {
	m.Message = quickfix.NewMessage()
	m.Header = fix41.NewHeader(&m.Message.Header)
	m.Body = &m.Message.Body
	m.Trailer.Trailer = &m.Message.Trailer

	m.Header.Set(field.NewMsgType("7"))
	m.Set(advid)
	m.Set(advtranstype)
	m.Set(symbol)
	m.Set(advside)
	m.Set(shares)

	return
}

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

// SetAdvId sets AdvId, Tag 2.
func (m Advertisement) SetAdvId(v string) {
	m.Set(field.NewAdvId(v))
}

// SetAdvRefID sets AdvRefID, Tag 3.
func (m Advertisement) SetAdvRefID(v string) {
	m.Set(field.NewAdvRefID(v))
}

// SetAdvSide sets AdvSide, Tag 4.
func (m Advertisement) SetAdvSide(v enum.AdvSide) {
	m.Set(field.NewAdvSide(v))
}

// SetAdvTransType sets AdvTransType, Tag 5.
func (m Advertisement) SetAdvTransType(v enum.AdvTransType) {
	m.Set(field.NewAdvTransType(v))
}

// SetCurrency sets Currency, Tag 15.
func (m Advertisement) SetCurrency(v string) {
	m.Set(field.NewCurrency(v))
}

// SetIDSource sets IDSource, Tag 22.
func (m Advertisement) SetIDSource(v enum.IDSource) {
	m.Set(field.NewIDSource(v))
}

// SetLastMkt sets LastMkt, Tag 30.
func (m Advertisement) SetLastMkt(v string) {
	m.Set(field.NewLastMkt(v))
}

// SetPrice sets Price, Tag 44.
func (m Advertisement) SetPrice(value decimal.Decimal, scale int32) {
	m.Set(field.NewPrice(value, scale))
}

// SetSecurityID sets SecurityID, Tag 48.
func (m Advertisement) SetSecurityID(v string) {
	m.Set(field.NewSecurityID(v))
}

// SetShares sets Shares, Tag 53.
func (m Advertisement) SetShares(value decimal.Decimal, scale int32) {
	m.Set(field.NewShares(value, scale))
}

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

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

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

// SetSymbolSfx sets SymbolSfx, Tag 65.
func (m Advertisement) SetSymbolSfx(v enum.SymbolSfx) {
	m.Set(field.NewSymbolSfx(v))
}

// SetTradeDate sets TradeDate, Tag 75.
func (m Advertisement) SetTradeDate(v string) {
	m.Set(field.NewTradeDate(v))
}

// SetIssuer sets Issuer, Tag 106.
func (m Advertisement) SetIssuer(v string) {
	m.Set(field.NewIssuer(v))
}

// SetSecurityDesc sets SecurityDesc, Tag 107.
func (m Advertisement) SetSecurityDesc(v string) {
	m.Set(field.NewSecurityDesc(v))
}

// SetURLLink sets URLLink, Tag 149.
func (m Advertisement) SetURLLink(v string) {
	m.Set(field.NewURLLink(v))
}

// SetSecurityType sets SecurityType, Tag 167.
func (m Advertisement) SetSecurityType(v enum.SecurityType) {
	m.Set(field.NewSecurityType(v))
}

// SetMaturityMonthYear sets MaturityMonthYear, Tag 200.
func (m Advertisement) SetMaturityMonthYear(v string) {
	m.Set(field.NewMaturityMonthYear(v))
}

// SetPutOrCall sets PutOrCall, Tag 201.
func (m Advertisement) SetPutOrCall(v enum.PutOrCall) {
	m.Set(field.NewPutOrCall(v))
}

// SetStrikePrice sets StrikePrice, Tag 202.
func (m Advertisement) SetStrikePrice(value decimal.Decimal, scale int32) {
	m.Set(field.NewStrikePrice(value, scale))
}

// SetMaturityDay sets MaturityDay, Tag 205.
func (m Advertisement) SetMaturityDay(v int) {
	m.Set(field.NewMaturityDay(v))
}

// SetOptAttribute sets OptAttribute, Tag 206.
func (m Advertisement) SetOptAttribute(v string) {
	m.Set(field.NewOptAttribute(v))
}

// SetSecurityExchange sets SecurityExchange, Tag 207.
func (m Advertisement) SetSecurityExchange(v string) {
	m.Set(field.NewSecurityExchange(v))
}

// GetAdvId gets AdvId, Tag 2.
func (m Advertisement) GetAdvId() (v string, err quickfix.MessageRejectError) {
	var f field.AdvIdField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetAdvRefID gets AdvRefID, Tag 3.
func (m Advertisement) GetAdvRefID() (v string, err quickfix.MessageRejectError) {
	var f field.AdvRefIDField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetAdvSide gets AdvSide, Tag 4.
func (m Advertisement) GetAdvSide() (v enum.AdvSide, err quickfix.MessageRejectError) {
	var f field.AdvSideField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetAdvTransType gets AdvTransType, Tag 5.
func (m Advertisement) GetAdvTransType() (v enum.AdvTransType, err quickfix.MessageRejectError) {
	var f field.AdvTransTypeField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetCurrency gets Currency, Tag 15.
func (m Advertisement) GetCurrency() (v string, err quickfix.MessageRejectError) {
	var f field.CurrencyField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetIDSource gets IDSource, Tag 22.
func (m Advertisement) GetIDSource() (v enum.IDSource, err quickfix.MessageRejectError) {
	var f field.IDSourceField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetLastMkt gets LastMkt, Tag 30.
func (m Advertisement) GetLastMkt() (v string, err quickfix.MessageRejectError) {
	var f field.LastMktField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetPrice gets Price, Tag 44.
func (m Advertisement) GetPrice() (v decimal.Decimal, err quickfix.MessageRejectError) {
	var f field.PriceField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetSecurityID gets SecurityID, Tag 48.
func (m Advertisement) GetSecurityID() (v string, err quickfix.MessageRejectError) {
	var f field.SecurityIDField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetShares gets Shares, Tag 53.
func (m Advertisement) GetShares() (v decimal.Decimal, err quickfix.MessageRejectError) {
	var f field.SharesField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetSymbol gets Symbol, Tag 55.
func (m Advertisement) 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 Advertisement) 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 Advertisement) GetTransactTime() (v time.Time, err quickfix.MessageRejectError) {
	var f field.TransactTimeField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetSymbolSfx gets SymbolSfx, Tag 65.
func (m Advertisement) GetSymbolSfx() (v enum.SymbolSfx, err quickfix.MessageRejectError) {
	var f field.SymbolSfxField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetTradeDate gets TradeDate, Tag 75.
func (m Advertisement) GetTradeDate() (v string, err quickfix.MessageRejectError) {
	var f field.TradeDateField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetIssuer gets Issuer, Tag 106.
func (m Advertisement) GetIssuer() (v string, err quickfix.MessageRejectError) {
	var f field.IssuerField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetSecurityDesc gets SecurityDesc, Tag 107.
func (m Advertisement) GetSecurityDesc() (v string, err quickfix.MessageRejectError) {
	var f field.SecurityDescField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetURLLink gets URLLink, Tag 149.
func (m Advertisement) GetURLLink() (v string, err quickfix.MessageRejectError) {
	var f field.URLLinkField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetSecurityType gets SecurityType, Tag 167.
func (m Advertisement) GetSecurityType() (v enum.SecurityType, err quickfix.MessageRejectError) {
	var f field.SecurityTypeField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetMaturityMonthYear gets MaturityMonthYear, Tag 200.
func (m Advertisement) GetMaturityMonthYear() (v string, err quickfix.MessageRejectError) {
	var f field.MaturityMonthYearField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetPutOrCall gets PutOrCall, Tag 201.
func (m Advertisement) GetPutOrCall() (v enum.PutOrCall, err quickfix.MessageRejectError) {
	var f field.PutOrCallField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetStrikePrice gets StrikePrice, Tag 202.
func (m Advertisement) GetStrikePrice() (v decimal.Decimal, err quickfix.MessageRejectError) {
	var f field.StrikePriceField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetMaturityDay gets MaturityDay, Tag 205.
func (m Advertisement) GetMaturityDay() (v int, err quickfix.MessageRejectError) {
	var f field.MaturityDayField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetOptAttribute gets OptAttribute, Tag 206.
func (m Advertisement) GetOptAttribute() (v string, err quickfix.MessageRejectError) {
	var f field.OptAttributeField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// GetSecurityExchange gets SecurityExchange, Tag 207.
func (m Advertisement) GetSecurityExchange() (v string, err quickfix.MessageRejectError) {
	var f field.SecurityExchangeField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}

// HasAdvId returns true if AdvId is present, Tag 2.
func (m Advertisement) HasAdvId() bool {
	return m.Has(tag.AdvId)
}

// HasAdvRefID returns true if AdvRefID is present, Tag 3.
func (m Advertisement) HasAdvRefID() bool {
	return m.Has(tag.AdvRefID)
}

// HasAdvSide returns true if AdvSide is present, Tag 4.
func (m Advertisement) HasAdvSide() bool {
	return m.Has(tag.AdvSide)
}

// HasAdvTransType returns true if AdvTransType is present, Tag 5.
func (m Advertisement) HasAdvTransType() bool {
	return m.Has(tag.AdvTransType)
}

// HasCurrency returns true if Currency is present, Tag 15.
func (m Advertisement) HasCurrency() bool {
	return m.Has(tag.Currency)
}

// HasIDSource returns true if IDSource is present, Tag 22.
func (m Advertisement) HasIDSource() bool {
	return m.Has(tag.IDSource)
}

// HasLastMkt returns true if LastMkt is present, Tag 30.
func (m Advertisement) HasLastMkt() bool {
	return m.Has(tag.LastMkt)
}

// HasPrice returns true if Price is present, Tag 44.
func (m Advertisement) HasPrice() bool {
	return m.Has(tag.Price)
}

// HasSecurityID returns true if SecurityID is present, Tag 48.
func (m Advertisement) HasSecurityID() bool {
	return m.Has(tag.SecurityID)
}

// HasShares returns true if Shares is present, Tag 53.
func (m Advertisement) HasShares() bool {
	return m.Has(tag.Shares)
}

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

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

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

// HasSymbolSfx returns true if SymbolSfx is present, Tag 65.
func (m Advertisement) HasSymbolSfx() bool {
	return m.Has(tag.SymbolSfx)
}

// HasTradeDate returns true if TradeDate is present, Tag 75.
func (m Advertisement) HasTradeDate() bool {
	return m.Has(tag.TradeDate)
}

// HasIssuer returns true if Issuer is present, Tag 106.
func (m Advertisement) HasIssuer() bool {
	return m.Has(tag.Issuer)
}

// HasSecurityDesc returns true if SecurityDesc is present, Tag 107.
func (m Advertisement) HasSecurityDesc() bool {
	return m.Has(tag.SecurityDesc)
}

// HasURLLink returns true if URLLink is present, Tag 149.
func (m Advertisement) HasURLLink() bool {
	return m.Has(tag.URLLink)
}

// HasSecurityType returns true if SecurityType is present, Tag 167.
func (m Advertisement) HasSecurityType() bool {
	return m.Has(tag.SecurityType)
}

// HasMaturityMonthYear returns true if MaturityMonthYear is present, Tag 200.
func (m Advertisement) HasMaturityMonthYear() bool {
	return m.Has(tag.MaturityMonthYear)
}

// HasPutOrCall returns true if PutOrCall is present, Tag 201.
func (m Advertisement) HasPutOrCall() bool {
	return m.Has(tag.PutOrCall)
}

// HasStrikePrice returns true if StrikePrice is present, Tag 202.
func (m Advertisement) HasStrikePrice() bool {
	return m.Has(tag.StrikePrice)
}

// HasMaturityDay returns true if MaturityDay is present, Tag 205.
func (m Advertisement) HasMaturityDay() bool {
	return m.Has(tag.MaturityDay)
}

// HasOptAttribute returns true if OptAttribute is present, Tag 206.
func (m Advertisement) HasOptAttribute() bool {
	return m.Has(tag.OptAttribute)
}

// HasSecurityExchange returns true if SecurityExchange is present, Tag 207.
func (m Advertisement) HasSecurityExchange() bool {
	return m.Has(tag.SecurityExchange)
}
