package soap

import (
	

	
)

type HeaderOption struct {
	key   string
	value string
}

func ( string,  string) *HeaderOption {
	return &HeaderOption{key: , value: }
}

type SoapHeader struct {
	to              string
	replyTo         string
	maxEnvelopeSize string
	timeout         string
	locale          string
	id              string
	action          string
	shellID         string
	resourceURI     string
	options         []HeaderOption
	message         *SoapMessage
}

type HeaderBuilder interface {
	To(string) *SoapHeader
	ReplyTo(string) *SoapHeader
	MaxEnvelopeSize(int) *SoapHeader
	Timeout(string) *SoapHeader
	Locale(string) *SoapHeader
	Id(string) *SoapHeader
	Action(string) *SoapHeader
	ShellId(string) *SoapHeader
	resourceURI(string) *SoapHeader
	AddOption(*HeaderOption) *SoapHeader
	Options([]HeaderOption) *SoapHeader
	Build(*SoapMessage) *SoapMessage
}

func ( *SoapHeader) ( string) *SoapHeader {
	.to = 
	return 
}

func ( *SoapHeader) ( string) *SoapHeader {
	.replyTo = 
	return 
}

func ( *SoapHeader) ( int) *SoapHeader {
	.maxEnvelopeSize = strconv.Itoa()
	return 
}

func ( *SoapHeader) ( string) *SoapHeader {
	.timeout = 
	return 
}

//nolint:stylecheck // Should be ShellID, but we stay compatible
func ( *SoapHeader) ( string) *SoapHeader {
	.id = 
	return 
}

func ( *SoapHeader) ( string) *SoapHeader {
	.action = 
	return 
}

func ( *SoapHeader) ( string) *SoapHeader {
	.locale = 
	return 
}

//nolint:stylecheck // Should be ShellID, but we stay compatible
func ( *SoapHeader) ( string) *SoapHeader {
	.shellID = 
	return 
}

func ( *SoapHeader) ( string) *SoapHeader {
	.resourceURI = 
	return 
}

func ( *SoapHeader) ( *HeaderOption) *SoapHeader {
	.options = append(.options, *)
	return 
}

func ( *SoapHeader) ( []HeaderOption) *SoapHeader {
	.options = 
	return 
}

func ( *SoapHeader) () *SoapMessage {
	 := .createElement(.message.envelope, "Header", DOM_NS_SOAP_ENV)

	if .to != "" {
		 := .createElement(, "To", DOM_NS_ADDRESSING)
		.SetContent(.to)
	}

	if .replyTo != "" {
		 := .createElement(, "ReplyTo", DOM_NS_ADDRESSING)
		 := .createMUElement(, "Address", DOM_NS_ADDRESSING, true)
		.SetContent(.replyTo)
	}

	if .maxEnvelopeSize != "" {
		 := .createMUElement(, "MaxEnvelopeSize", DOM_NS_WSMAN_DMTF, true)
		.SetContent(.maxEnvelopeSize)
	}

	if .timeout != "" {
		 := .createElement(, "OperationTimeout", DOM_NS_WSMAN_DMTF)
		.SetContent(.timeout)
	}

	if .id != "" {
		 := .createElement(, "MessageID", DOM_NS_ADDRESSING)
		.SetContent(.id)
	}

	if .locale != "" {
		 := .createMUElement(, "Locale", DOM_NS_WSMAN_DMTF, false)
		.SetAttr("xml:lang", .locale)
		 := .createMUElement(, "DataLocale", DOM_NS_WSMAN_MSFT, false)
		.SetAttr("xml:lang", .locale)
	}

	if .action != "" {
		 := .createMUElement(, "Action", DOM_NS_ADDRESSING, true)
		.SetContent(.action)
	}

	if .shellID != "" {
		 := .createElement(, "SelectorSet", DOM_NS_WSMAN_DMTF)
		 := .createElement(, "Selector", DOM_NS_WSMAN_DMTF)
		.SetAttr("Name", "ShellId")
		.SetContent(.shellID)
	}

	if .resourceURI != "" {
		 := .createMUElement(, "ResourceURI", DOM_NS_WSMAN_DMTF, true)
		.SetContent(.resourceURI)
	}

	if len(.options) > 0 {
		 := .createElement(, "OptionSet", DOM_NS_WSMAN_DMTF)
		for ,  := range .options {
			 := .createElement(, "Option", DOM_NS_WSMAN_DMTF)
			.SetAttr("Name", .key)
			.SetContent(.value)
		}
	}

	return .message
}

func ( *SoapHeader) ( *dom.Element,  string,  dom.Namespace) ( *dom.Element) {
	 = dom.CreateElement()
	.AddChild()
	.SetTo()
	return
}

func ( *SoapHeader) ( *dom.Element,  string,  dom.Namespace,  bool) ( *dom.Element) {
	 = .createElement(, , )
	 := "false"
	if  {
		 = "true"
	}
	.SetAttr("mustUnderstand", )
	return
}