2026-05-07 10:16:46 +08:00
|
|
|
package probe
|
|
|
|
|
|
|
|
|
|
import "supply-intelligence/internal/domain"
|
|
|
|
|
|
2026-05-12 18:49:52 +08:00
|
|
|
func NextAccountStatus(current domain.AccountStatus, classification domain.ProbeClassification, consecutiveExplicitFailures int) domain.AccountStatus {
|
2026-05-07 10:16:46 +08:00
|
|
|
switch classification {
|
|
|
|
|
case domain.ProbeClassificationSuccess:
|
|
|
|
|
return domain.AccountStatusActive
|
|
|
|
|
case domain.ProbeClassificationExplicitFailure:
|
|
|
|
|
switch current {
|
|
|
|
|
case domain.AccountStatusActive:
|
|
|
|
|
return domain.AccountStatusSuspended
|
|
|
|
|
case domain.AccountStatusSuspended:
|
2026-05-12 18:49:52 +08:00
|
|
|
if consecutiveExplicitFailures >= 3 {
|
|
|
|
|
return domain.AccountStatusDisabled
|
|
|
|
|
}
|
|
|
|
|
return domain.AccountStatusSuspended
|
2026-05-07 10:16:46 +08:00
|
|
|
default:
|
|
|
|
|
return current
|
|
|
|
|
}
|
|
|
|
|
case domain.ProbeClassificationInconclusive:
|
|
|
|
|
fallthrough
|
|
|
|
|
default:
|
|
|
|
|
return current
|
|
|
|
|
}
|
|
|
|
|
}
|