package main

import (
	"fmt"

	ctoai "github.com/cto-ai/sdk-go"
)

func main() {
	client := ctoai.NewClient()

	pipeline, err := client.Prompt.Input("pipeline", "Which pipeline do you want to deploy?", ctoai.OptInputAllowEmpty(false))
	if err != nil {
		panic(err)
	}

	event := map[string]interface{}{
		"stage":       "Deployment",
		"status":      "Succeeded",
		"stage_ref":   "956b425e5bee",
		"pipeline_id": pipeline,
	}

	err = client.Sdk.Track([]string{}, "", event)
	if err != nil {
		panic(err)
	}

	err = client.Ux.Print(fmt.Sprintf("🚀 %s's successful deployment has been recorded!", pipeline))
	if err != nil {
		panic(err)
	}
}
