package hostops import ( "time" "github.com/carlosframework/platform/internal/hostbox" "github.com/carlosframework/platform/internal/hostclaim" ) func retirementScope(host, incarnation, target string, refs map[string]hostclaim.RetirementEvidenceRef) (hostclaim.ParkScope, error) { if target == "" || len(refs) == 0 { return hostclaim.ParkScope{}, ErrPending } var latest time.Time for box, ref := range refs { if ref.Box != box || ref.EvidenceAt.IsZero() { return hostclaim.ParkScope{}, ErrIdentity } if ref.EvidenceAt.After(latest) { latest = ref.EvidenceAt } } scope := hostclaim.ParkScope{Location: target, Incarnation: incarnation, EvidenceAt: latest, RequestLimit: hostbox.RequestLimit} return scope, scope.Validate(host) }