package model import "time" // Settings are global to the single-admin installation. type Settings struct { UpdateIntervalSeconds int UpdaterEnabled bool IPv6Enabled bool IPv4Endpoints []string IPv6Endpoints []string LastIPv4 string LastIPv6 string LastRunAt time.Time LastRunStatus string UpdatedAt time.Time } // Credential is a reusable, encrypted Hetzner project token. type Credential struct { ID int64 Label string Ciphertext []byte Nonce []byte Fingerprint string CreatedAt time.Time } // Zone is one Hetzner DNS zone selected by the administrator. type Zone struct { ID int64 CredentialID int64 ProviderID string Name string CreatedAt time.Time LastSyncAt time.Time LastError string } // Target is the desired state for one host name and its dynamic address families. type Target struct { ID int64 ZoneID int64 RecordName string FQDN string UpdateIPv4 bool UpdateIPv6 bool Active bool StaticIPv4 string StaticIPv6 string Description string TTL int LastUpdatedAt time.Time LastStatus string LastError string CreatedAt time.Time ArchivedAt time.Time } // CNAMERecord is a static DNS alias managed directly in a zone. It is kept // separate from Target because the DynDNS worker must never overwrite it. type CNAMERecord struct { ID int64 ZoneID int64 Active bool RecordName string FQDN string Destination string Description string TTL int CreatedAt time.Time UpdatedAt time.Time } // PiHoleIntegration is one remotely managed Pi-hole v6 instance. API // passwords are returned separately and never exposed to templates. type PiHoleIntegration struct { ID int64 Name string BaseURL string InsecureTLS bool CreatedAt time.Time UpdatedAt time.Time LastSyncAt time.Time LastError string } type PiHoleCredential struct { Ciphertext []byte Nonce []byte } // SoftwareUpdateSettings contains the locally persisted update state. The // encrypted registry credential is returned only to trusted backend components and // is never passed to templates. type SoftwareUpdateSettings struct { RegistryUsername string TokenCiphertext []byte TokenNonce []byte LatestVersion string ReleaseURL string DesiredVersion string LastCheckedAt time.Time LastError string UpdatedAt time.Time } // PiHoleRecordLink tracks whether a local DNS entry is managed by this UI or // merely retained at Pi-hole after being removed from the active WebUI list. type PiHoleRecordLink struct { ID int64 IntegrationID int64 Active bool Value string CreatedAt time.Time UpdatedAt time.Time ArchivedAt time.Time } type User struct { ID int64 Username string DisplayName string Role string Active bool CreatedAt time.Time UpdatedAt time.Time LastLoginAt time.Time } func (u User) IsAdmin() bool { return u.Role == "admin" } type AccessGrant struct { ID int64 UserID int64 ZoneID int64 TargetID *int64 CanManageTargets bool CanCreateTargets bool } // Session deliberately contains only hashes/random CSRF material, never a password. type Session struct { ID int64 UserID int64 Username string DisplayName string Role string TokenHash string CSRFToken string CreatedAt time.Time ExpiresAt time.Time ReauthUntil time.Time } type AuditEvent struct { ID int64 CreatedAt time.Time Kind string Message string } type UpdateRun struct { ID int64 StartedAt time.Time FinishedAt time.Time Status string IPv4 string IPv6 string Summary string } type Dashboard struct { Settings Settings Zones []Zone ActiveTargets int RecentRuns []UpdateRun RecentEvents []AuditEvent NextRunAt time.Time SchedulerRunning bool ErrorCount int }