package service import "github.com/vasyakrg/dns-autoresolver/internal/diff" // Domain check statuses persisted in domains.last_check_status. "unknown" is // the DB default for a domain that has never been checked. Single source of // truth — the scheduler aliases these, the API check handler writes them. const ( StatusUnknown = "unknown" StatusInSync = "in_sync" StatusDrift = "drift" StatusError = "error" ) // DeriveStatus maps a successful check's changeset to a domain status: // actionable drift (managed adds/updates/prunes) → "drift", otherwise // "in_sync". A failed check (provider/loader error) is "error" and handled by // the caller, which has the error in hand. func DeriveStatus(cs diff.Changeset) string { if len(cs.Actionable()) > 0 { return StatusDrift } return StatusInSync }