package app

import 

// A Twitter card: https://developer.twitter.com/en/docs/twitter-for-websites/cards
type TwitterCard struct {
	// The card type, which will be one of “summary”, “summary_large_image”,
	// “app”, or “player”.
	Card string

	// Username for the website used in the card footer.
	Site string

	// Username for the content creator / author.
	Creator string

	// A concise title for the related content.
	Title string

	// A description that concisely summarizes the content as appropriate for
	// presentation within a Tweet.
	Description string

	// A URL to a unique image representing the content of the page.
	Image string

	// A text description of the image conveying the essential nature of an
	// image to users who are visually impaired. Maximum 420 characters.
	ImageAlt string
}

func ( TwitterCard) () map[string]string {
	 := make(map[string]string)

	if .Card != "" {
		["twitter:card"] = .Card
	}

	if .Site != "" {
		if !strings.HasPrefix(.Site, "@") {
			.Site = "@" + .Site
		}
		["twitter:site"] = .Site
	}

	if .Creator != "" {
		if !strings.HasPrefix(.Creator, "@") {
			.Creator = "@" + .Creator
		}
		["twitter:creator"] = .Creator
	}

	if .Title != "" {
		["twitter:title"] = .Title
	}

	if .Description != "" {
		["twitter:description"] = .Description
	}

	if .Image != "" {
		["twitter:image"] = .Image
	}

	if .ImageAlt != "" {
		["twitter:image:alt"] = .ImageAlt
	}

	return 
}