package app

import "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models"

// MarshalToSwagger encodes first class object
func (obj *EmailMessage) MarshalToSwagger() *workflow_models.EmailMessage {
	headers := &workflow_models.Headers{}
	// for _, itm := range obj.Headers {
	// 	val := []string{}
	// 	for _, s := range itm.Values {
	// 		val = append(val, s)
	// 	}
	// 	values := []string{}
	// 	for _, i := range itm.Values {
	// 		values = append(values, i)
	// 	}
	// 	headers = &workflow_models.Headers{
	// 		Key:  itm.Key,
	// 		Values: values,
	// 	}
	// }
	return &workflow_models.EmailMessage{
		ID:                    obj.ID,
		ActivityID:            obj.ActivityID,
		BCCAddress:            obj.BCCAddress,
		CCAddress:             obj.CCAddress,
		CreatedByID:           obj.CreatedByID,
		CreatedDate:           obj.CreatedDate.Time.Format(dateTimeFormat),
		EmailMessageID:        obj.EmailMessageID,
		FromAddress:           obj.FromAddress,
		FromName:              obj.FromName,
		HasAttachment:         obj.HasAttachment,
		Headers:               headers,
		HTML:                  obj.HTML,
		Incoming:              obj.Incoming,
		IsClientManaged:       obj.IsClientManaged,
		IsExternallyManaged:   obj.IsExternallyManaged,
		LastModifiedByID:      obj.LastModifiedByID,
		LastModifiedDate:      obj.LastModifiedDate.Time.Format(dateTimeFormat),
		MessageDate:           obj.MessageDate.Time.Format(dateTimeFormat),
		MessageIdentifier:     obj.MessageIdentifier,
		ParentID:              obj.ParentID,
		RelatedToID:           obj.RelatedToID,
		RelationAddress:       obj.RelationAddress,
		RelationID:            obj.RelationID,
		RelationObjectType:    obj.RelationObjectType,
		RelationType:          obj.RelationType,
		ReplyToEmailMessageID: obj.ReplyToEmailMessageID,
		Status:                obj.Status,
		Subject:               obj.Subject,
		Text:                  obj.Text,
		ThreadIdentifier:      obj.ThreadIdentifier,
		ToAddress:             obj.ToAddress,
		ValidatedFromAddress:  obj.ValidatedFromAddress,
	}
}
