package models

import "time"

type Role string

const (
	RoleAdmin  Role = "admin"
	RoleEditor Role = "editor"
	RoleViewer Role = "viewer"
)

type Organization struct {
	ID        int64
	Name      string
	Theme     string
	ThemeMode string
	CreatedAt time.Time
}

type User struct {
	ID           int64
	Organization int64
	Name         string
	Email        string
	PasswordHash string
	Role         Role
	OTPSecret    string
	OTPEnabled   bool
	CreatedAt    time.Time
}

type VMGroup struct {
	ID             int64
	OrganizationID int64
	Name           string
	Description    string
	ColorToken     string
	CreatedAt      time.Time
}

type Node struct {
	ID                 int64
	OrganizationID     int64
	GroupID            *int64
	GroupName          string
	Tag                string
	Name               string
	Distro             string
	Hostname           string
	IPAddress          string
	MACAddress         string
	SSHPort            int
	SSHUsername        string
	SSHPassword        string
	PackageManager     string
	Architecture       string
	HostModel          string
	KernelVersion      string
	CPUModel           string
	GPUModel           string
	DefaultShell       string
	PackageCount       int64
	MemoryTotalMB      int64
	DiskTotalGB        int64
	CPUUsage           float64
	RAMUsage           float64
	DiskUsage          float64
	UptimeSeconds      int64
	LastSeenAt         *time.Time
	AutoUpdatesEnabled bool
	Notes              string
	CreatedAt          time.Time
	UpdatedAt          time.Time
}

type AutomationJob struct {
	ID             int64
	OrganizationID int64
	NodeID         *int64
	GroupID        *int64
	NodeName       string
	GroupName      string
	Tag            string
	Name           string
	TriggerType    string
	Schedule       string
	Command        string
	Enabled        bool
	LastRunAt      *time.Time
	NextRunAt      *time.Time
	CreatedAt      time.Time
}

type CommandRun struct {
	ID           int64
	JobID        *int64
	NodeID       int64
	JobName      string
	NodeName     string
	Action       string
	Status       string
	Output       string
	TriggeredBy  *int64
	StartedAt    time.Time
	FinishedAt   *time.Time
	DurationText string
}
