package api

// SystemSecurityState holds information about the current security state.
type SystemSecurityState struct {
	EncryptedVolumes                []SystemSecurityEncryptedVolume       `incusos:"-"                               json:"encrypted_volumes"                  yaml:"encrypted_volumes"`
	EncryptionRecoveryKeysRetrieved bool                                  `json:"encryption_recovery_keys_retrieved" yaml:"encryption_recovery_keys_retrieved"`
	DriveRecoveryKeys               map[string]string                     `incusos:"-"                               json:"drive_recovery_keys"                yaml:"drive_recovery_keys"`
	PoolRecoveryKeys                map[string]string                     `incusos:"-"                               json:"pool_recovery_keys"                 yaml:"pool_recovery_keys"`
	SecureBootCertificates          []SystemSecuritySecureBootCertificate `incusos:"-"                               json:"secure_boot_certificates"           yaml:"secure_boot_certificates"`
	SecureBootEnabled               bool                                  `incusos:"-"                               json:"secure_boot_enabled"                yaml:"secure_boot_enabled"`
	SystemStateIsTrusted            bool                                  `incusos:"-"                               json:"system_state_is_trusted"            yaml:"system_state_is_trusted"`
	TPMStatus                       string                                `incusos:"-"                               json:"tpm_status"                         yaml:"tpm_status"`
}

// SystemSecurityConfig holds additional security configuration settings.
type SystemSecurityConfig struct {
	CustomCACerts          []string `json:"custom_ca_certs,omitempty" yaml:"custom_ca_certs,omitempty"`
	EncryptionRecoveryKeys []string `json:"encryption_recovery_keys"  yaml:"encryption_recovery_keys"`
}

// SystemSecurity defines a struct to hold information about the system's security state.
type SystemSecurity struct {
	Config SystemSecurityConfig `json:"config" yaml:"config"`

	State SystemSecurityState `json:"state" yaml:"state"`
}

// SystemSecuritySecureBootCertificate defines a struct that holds information about Secure Boot keys present on the host.
type SystemSecuritySecureBootCertificate struct {
	Type        string `json:"type"        yaml:"type"`
	Fingerprint string `json:"fingerprint" yaml:"fingerprint"`
	Subject     string `json:"subject"     yaml:"subject"`
	Issuer      string `json:"issuer"      yaml:"issuer"`
}

// SystemSecurityEncryptedVolume defines a struct that holds basic information about an encrypted volume.
type SystemSecurityEncryptedVolume struct {
	Volume string `json:"volume" yaml:"volume"`
	State  string `json:"state"  yaml:"state"`
}
