package colorlight

type Style struct {
	I uint8 `json:"i"` //Italic
	B uint8 `json:"b"` //Bold
	U uint8 `json:"u"` //Underline
}

type Scroll struct {
	Dir         string `json:"dir"`
	Isconnected string `json:"isconnected"`
	Speed       string `json:"speed"`
}

type Font struct {
	Name  string `json:"name"` //"隶书|楷体|黑体|宋体|仿宋|default", (For English please use default)
	Size  int    `json:"size"`
	Style Style  `json:"style"`
	Color string `json:"color"`
}

//Quick Send Single-Line Text Program
type ProgramSingleLineText struct {
	Text    string `json:"text"` //节目内容
	X       int    `json:"x"`
	Y       int    `json:"y"`
	Width   int    `json:"width"`
	Height  int    `json:"height"`
	Font    Font   `json:"font"`
	Bgcolor string `json:"bgcolor"`
	Scroll  Scroll `json:"scroll"`
}

func NewProgramSingleLineText(
	text string, //显示内容
	textColor, Bgcolor string, //显示颜色
	X, Y, width, height int, //显示位置
	fontname string, fontsize int, I, B, U uint8, //显示字体
	ScrollDir, Speed string, //滚动方向和速度
) *ProgramSingleLineText {
	return &ProgramSingleLineText{
		Text:   text,
		X:      X,
		Y:      Y,
		Width:  width,
		Height: height,
		Font: Font{
			Name: fontname,
			Size: fontsize,
			Style: Style{
				I: I,
				B: B,
				U: U,
			},
			Color: textColor,
		},
		Bgcolor: Bgcolor,
		Scroll: Scroll{
			Dir:         ScrollDir,
			Isconnected: "0",
			Speed:       Speed,
		},
	}
}
