@Override
    public ClientStatus determineStatus(ClientVersionBean cvb, List<ContractBean> contracts) {
        ClientStatus currentStatus = cvb.getStatus();

        boolean anyAwaitingApproval = contracts.stream().anyMatch(c -> c.getStatus() == ContractStatus.AwaitingApproval);

        if (cvb.getStatus() == ClientStatus.Retired) {
            return ClientStatus.Retired;
        }

        if (anyAwaitingApproval) {
            return ClientStatus.AwaitingApproval;
        }
        // If already registered, then continue to be registered (indicates some number of contracts are still active on gateway).
        if (currentStatus == ClientStatus.Registered) {
            return ClientStatus.Registered;
        }
        // No contracts and not registered, then just created state
        if (contracts.isEmpty()) {
            return ClientStatus.Created;
        }
        // Ready to be published
        return ClientStatus.Ready;
    }
@see io.apiman.manager.api.core.IClientValidator#isReady(io.apiman.manager.api.beans.clients.ClientVersionBean, boolean)
manager/api/core/src/main/java/io/apiman/manager/api/core/util/EntityValidator.java