package mxgateway

import (
	pb "gitea.dohertylan.com/dohertj2/mxaccessgw/clients/go/internal/generated"
)

// StatusSucceeded reports whether an MXSTATUS_PROXY entry represents success.
//
// The wire contract makes Category authoritative: an entry succeeds only when
// its category is MX_STATUS_CATEGORY_OK. The Success member mirrors the raw
// 16-bit COM value verbatim for diagnostics and is not a boolean, so it takes
// no part in the verdict. A nil entry is success (nothing was reported); a
// present entry with an unspecified category is a failure, because the worker
// always maps a category and an unmapped one is not proven OK.
func StatusSucceeded(status *MxStatusProxy) bool {
	return status == nil || status.GetCategory() == pb.MxStatusCategory_MX_STATUS_CATEGORY_OK
}
