func (mc *MessageCard) Validate() error {
	if mc.ValidateFunc != nil {
		return mc.ValidateFunc()
	}
	if (mc.Text == "") && (mc.Summary == "") {
		return fmt.Errorf("invalid message card: summary or text field is required")
	}
	return nil
}
Validate validates a MessageCard calling ValidateFunc if defined,
otherwise, a default validation occurs
package goteamsnotify
import (
	"errors"
	"fmt"
	"strings"
)
const (
	PotentialActionOpenURIType = "OpenUri"
	PotentialActionHTTPPostType = "HttpPOST"
	PotentialActionActionCardType = "ActionCard"
	PotentialActionInvokeAddInCommandType = "InvokeAddInCommand"
	PotentialActionActionCardInputTextInputType = "TextInput"
	PotentialActionActionCardInputDateInputType = "DateInput"
	PotentialActionActionCardInputMultichoiceInput = "MultichoiceInput"
)
const PotentialActionMaxSupported = 4
var ErrPotentialActionsLimitReached = errors.New("potential actions collection limit reached")
type MessageCardPotentialAction struct {
	Type string `json:"@type"`
	Name string `json:"name"`
	MessageCardPotentialActionOpenURI
	MessageCardPotentialActionHTTPPOST
	MessageCardPotentialActionActionCard
	MessageCardPotentialActionInvokeAddInCommand
}
type MessageCardPotentialActionOpenURI struct {
	Targets []MessageCardPotentialActionOpenURITarget `json:"targets,omitempty"`
}
type MessageCardPotentialActionHTTPPOST struct {
	Target string `json:"target,omitempty"`
	Headers []MessageCardPotentialActionHTTPPOSTHeader `json:"headers,omitempty"`
	Body string `json:"body,omitempty"`
	BodyContentType string `json:"bodyContentType,omitempty"`
}
type MessageCardPotentialActionActionCard struct {
	Inputs []MessageCardPotentialActionActionCardInput `json:"inputs,omitempty"`
	Actions []MessageCardPotentialActionActionCardAction `json:"actions,omitempty"`
}
type MessageCardPotentialActionActionCardAction struct {
	Type string `json:"@type"`
	Name string `json:"name"`
	MessageCardPotentialActionOpenURI
	MessageCardPotentialActionHTTPPOST
}
type MessageCardPotentialActionInvokeAddInCommand struct {
	AddInID string `json:"addInId,omitempty"`
	DesktopCommandID string `json:"desktopCommandId,omitempty"`
	InitializationContext interface{} `json:"initializationContext,omitempty"`
}
type MessageCardPotentialActionOpenURITarget struct {
	OS string `json:"os,omitempty"`
	URI string `json:"uri,omitempty"`
}
type MessageCardPotentialActionHTTPPOSTHeader struct {
	Name string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}
type MessageCardPotentialActionActionCardInput struct {
	Type string `json:"@type"`
	ID string `json:"id,omitempty"`
	Title string `json:"title,omitempty"`
	Value string `json:"value,omitempty"`
	MessageCardPotentialActionActionCardInputMultichoiceInput
	MessageCardPotentialActionActionCardInputTextInput
	MessageCardPotentialActionActionCardInputDateInput
	IsRequired bool `json:"isRequired,omitempty"`
}
type MessageCardPotentialActionActionCardInputTextInput struct {
	MaxLength int `json:"maxLength,omitempty"`
	IsMultiline bool `json:"isMultiline,omitempty"`
}
type MessageCardPotentialActionActionCardInputMultichoiceInput struct {
	Choices []struct {
		Display string `json:"display,omitempty"`
		Value   string `json:"value,omitempty"`
	} `json:"choices,omitempty"`
	Style string `json:"style,omitempty"`
	IsMultiSelect bool `json:"isMultiSelect,omitempty"`
}
type MessageCardPotentialActionActionCardInputDateInput struct {
	IncludeTime bool `json:"includeTime,omitempty"`
}
type MessageCardSectionFact struct {
	Name string `json:"name"`
	Value string `json:"value"`
}
type MessageCardSectionImage struct {
	Image string `json:"image"`
	Title string `json:"title"`
}
type MessageCardSection struct {
	Title string `json:"title,omitempty"`
	Text string `json:"text,omitempty"`
	ActivityImage string `json:"activityImage,omitempty"`
	ActivityTitle string `json:"activityTitle,omitempty"`
	ActivitySubtitle string `json:"activitySubtitle,omitempty"`
	ActivityText string `json:"activityText,omitempty"`
	HeroImage *MessageCardSectionImage `json:"heroImage,omitempty"`
	Facts []MessageCardSectionFact `json:"facts,omitempty"`
	Images []*MessageCardSectionImage `json:"images,omitempty"`
	PotentialActions []*MessageCardPotentialAction `json:"potentialAction,omitempty"`
	Markdown bool `json:"markdown,omitempty"`
	StartGroup bool `json:"startGroup,omitempty"`
}
type MessageCard struct {
	Type string `json:"@type"`
	Context string `json:"@context"`
	Summary string `json:"summary,omitempty"`
	Title string `json:"title,omitempty"`
	Text string `json:"text,omitempty"`
	ThemeColor string `json:"themeColor,omitempty"`
	ValidateFunc func() error `json:"-"`
	Sections []*MessageCardSection `json:"sections,omitempty"`
	PotentialActions []*MessageCardPotentialAction `json:"potentialAction,omitempty"`
}
func validatePotentialAction(pa *MessageCardPotentialAction) error {
	if pa == nil {
		return fmt.Errorf("nil MessageCardPotentialAction received")
	}
	switch pa.Type {
	case PotentialActionOpenURIType,
		PotentialActionHTTPPostType,
		PotentialActionActionCardType,
		PotentialActionInvokeAddInCommandType:
	default:
		return fmt.Errorf("unknown type %s for potential action %s", pa.Type, pa.Name)
	}
	if pa.Name == "" {
		return fmt.Errorf("missing name value for MessageCardPotentialAction")
	}
	return nil
}
func addPotentialAction(collection *[]*MessageCardPotentialAction, actions ...*MessageCardPotentialAction) error {
	for _, a := range actions {
		logger.Printf("addPotentialAction: MessageCardPotentialAction received: %+v\n", a)
		if err := validatePotentialAction(a); err != nil {
			logger.Printf("addPotentialAction: validation failed: %v", err)
			return err
		}
		if len(*collection) > PotentialActionMaxSupported {
			logger.Printf("addPotentialAction: failed to add potential action: %v", ErrPotentialActionsLimitReached.Error())
			return fmt.Errorf("func addPotentialAction: failed to add potential action: %w", ErrPotentialActionsLimitReached)
		}
		*collection = append(*collection, a)
	}
	return nil
}
func (mc *MessageCard) AddSection(section ...*MessageCardSection) error {
	for _, s := range section {
		logger.Printf("AddSection: MessageCardSection received: %+v\n", s)
		if s == nil {
			return fmt.Errorf("func AddSection: nil MessageCardSection received")
		}
		switch {
		case s.Images != nil:
		case s.Facts != nil:
		case s.HeroImage != nil:
		case s.StartGroup:
		case s.Markdown:
		case s.ActivityText != "":
		case s.ActivitySubtitle != "":
		case s.ActivityTitle != "":
		case s.ActivityImage != "":
		case s.Text != "":
		case s.Title != "":
		default:
			logger.Println("AddSection: No cases matched, all fields assumed to be at zero-value, skipping section")
			return fmt.Errorf("all fields found to be at zero-value, skipping section")
		}
		logger.Println("AddSection: section contains at least one non-zero value, adding section")
		mc.Sections = append(mc.Sections, s)
	}
	return nil
}
func (mc *MessageCard) AddPotentialAction(actions ...*MessageCardPotentialAction) error {
	return addPotentialAction(&mc.PotentialActions, actions...)
}