package v1alpha1

import (
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type InfraSpec struct {
	// 1. Rancher/Cloud Settings
	// The "Master" credential name in cattle-global-data
	// +required
	CloudCredentialSecret string `json:"cloudCredentialSecret"`
	RancherURL            string `json:"rancherUrl"`
	// This removes the need for auto-discovery.
	HarvesterURL string `json:"harvesterUrl"`
	// 2. Environment Defaults
	VmNamespace string `json:"vmNamespace"`
	ImageName   string `json:"imageName"`
	NetworkName string `json:"networkName"`
	SshUser     string `json:"sshUser"`

	// 3. Governance Configs
	// +kubebuilder:validation:Optional
	RKE2ConfigYAML string `json:"rke2ConfigYaml"`
	// +kubebuilder:validation:Optional
	UserData string `json:"userData"`
}

type InfraStatus struct {
	Ready bool `json:"ready"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
type Infra struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              InfraSpec   `json:"spec,omitempty"`
	Status            InfraStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
type InfraList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Infra `json:"items"`
}

func init() {
	SchemeBuilder.Register(&Infra{}, &InfraList{})
}
