package main

import (
	"context"
	"embed"
	"log"

	"github.com/wailsapp/wails/v2"
	"github.com/wailsapp/wails/v2/pkg/options"
	"github.com/wailsapp/wails/v2/pkg/options/assetserver"
)

//go:embed all:frontend/dist
var assets embed.FS

func main() {
	ms := NewMatrixService()

	err := wails.Run(&options.App{
		Title:  "matrix_client_pc",
		Width:  1280,
		Height: 800,
		AssetServer: &assetserver.Options{
			Assets: assets,
		},
		BackgroundColour: &options.RGBA{R: 26, G: 27, B: 30, A: 1},
		OnStartup: func(ctx context.Context) {
			ms.SetContext(ctx)
		},
		Bind: []interface{}{
			ms,
		},
	})
	if err != nil {
		log.Fatalln("Wails error:", err)
	}
}
