package colorlight

type ProgramVsn struct {
	Programs Programs `json:"Programs"`
}

func (o *ProgramVsn) SetInformation(Width, Height string) {
	o.Programs.Program.Information.Width = Width
	o.Programs.Program.Information.Height = Height
}
func (o *ProgramVsn) AddPage(page *Page) {
	o.Programs.Program.Pages = append(o.Programs.Program.Pages, *page)
}

type Programs struct {
	Program Program `json:"Program"`
}
type Program struct {
	Information Information `json:"Information"`
	Pages       []Page      `json:"Pages"`
}
type Information struct {
	Width  string `json:"Width"`
	Height string `json:"Height"`
}
type Page struct {
	AppointDuration string     `json:"AppointDuration"`
	LoopType        string     `json:"LoopType"`
	BgColor         string     `json:"BgColor"`
	BgFile          FileSource `json:"BgFile"`
	Regions         []Region   `json:"Regions"`
}

func (o *Page) SetData(AppointDuration, LoopType, BgColor, FilePath string) {
	o.AppointDuration = AppointDuration
	o.LoopType = LoopType
	o.BgColor = BgColor
	o.BgFile.IsRelative = "1"
	o.BgFile.FilePath = FilePath
}
func (o *Page) AddRegion(region *Region) {
	o.Regions = append(o.Regions, *region)
}

type FileSource struct {
	FilePath   string `json:"FilePath"`   //"./program1.files/abc.jpg", the " program1" is the vsn file name (program1.vsn). i.e., if you have a program named program1.vsn, then the file path should be ./program1.files/.
	IsRelative string `json:"IsRelative"` //Must be 1
}

type Rect struct {
	X           string `json:"X"`
	Y           string `json:"Y"`
	Width       string `json:"Width"`
	Height      string `json:"Height"`
	BorderWidth string `json:"BorderWidth"`
	BorderColor string `json:"BorderColor"`
}

func (o *Rect) SetData(X, Y, Width, Height, BorderWidth, BorderColor string) {
	o.X = X
	o.Y = Y
	o.Width = Width
	o.Height = Height
	o.BorderWidth = BorderWidth
	o.BorderColor = BorderColor
}
