package entity

import (
	"awesome_cli/internal/ui"
)

type VirtualMachineOutput struct {
	UUID          string   `json:"vm_uuid,omitempty"`
	Status        VMStatus `json:"status,omitempty"`
	Name          string   `json:"name,omitempty"`
	Autostart     bool     `json:"autostart,omitempty"`
	CPU           int      `json:"cpu,omitempty"`
	DatastoreName string   `json:"datastore_name,omitempty"`
	Memory        int      `json:"memory,omitempty"`
}

type VMStatus int

const (
	Creating VMStatus = iota + 1
	Running
	Stopped
	Failed
	Paused
)

func (s VMStatus) String() string {
	switch s {
	case Creating:
		return ui.SetColor(ui.Yellow, "Creating")
	case Running:
		return ui.SetColor(ui.Green, "Running")
	case Stopped:
		return ui.SetColor(ui.Red, "Stopped")
	case Failed:
		return ui.SetColor(ui.Red, "Failed")
	case Paused:
		return ui.SetColor(ui.Yellow, "Paused")
	default:
		return "Unknown"
	}
}
