package hostops import ( "github.com/carlosframework/platform/internal/hostactors" "github.com/carlosframework/platform/internal/park" ) // ClaimMoveRosterPlaces is shared by the console preflight and the start CAS. func ClaimMoveRosterPlaces(r hostactors.Roster, source, target, recRegion, to string, homeNames ...string) bool { if len(homeNames) > 1 { return false } home := "" if len(homeNames) == 1 { home = homeNames[0] } if home != "" && park.PlacementRegion(home) != home { return false } src, sourceOK := r.Boxes[source] dst, targetOK := r.Boxes[target] if !sourceOK || !targetOK || source == target || src.State != "active" || dst.State != "active" || src.Enrollment == "" || dst.Enrollment == "" || src.Region == "" || dst.Region == "" { return false } from, into := park.PlacementRegion(park.HomePlacementCode(home, src.Region)), park.PlacementRegion(park.HomePlacementCode(home, dst.Region)) return from != "" && into != "" && from != into && from == park.PlacementRegion(recRegion) && into == park.PlacementRegion(to) }