#ifndef SERVICES_ON_DEVICE_MODEL_BACKEND_H_
#define SERVICES_ON_DEVICE_MODEL_BACKEND_H_
#include "base/component_export.h"
#include "base/types/expected.h"
#include "services/on_device_model/backend_model.h"
#include "services/on_device_model/public/cpp/service_client.h"
#include "services/on_device_model/public/mojom/on_device_model.mojom.h"
#include "services/on_device_model/public/mojom/on_device_model_service.mojom.h"
namespace on_device_model {
class BackendModel;
class COMPONENT_EXPORT(ON_DEVICE_MODEL) Backend
: public base::RefCountedThreadSafe<Backend> {
public:
virtual base::expected<void, ServiceDisconnectReason> CanCreate() = 0;
virtual Capabilities GetCapabilities(ModelFile model_file) = 0;
virtual base::expected<std::unique_ptr<BackendModel>, mojom::LoadModelResult>
CreateWithResult(mojom::LoadModelParamsPtr params,
base::OnceClosure on_complete) = 0;
virtual void LoadTextSafetyModel(
mojom::TextSafetyModelParamsPtr params,
mojo::PendingReceiver<mojom::TextSafetyModel> model) = 0;
virtual std::pair<mojom::DevicePerformanceInfoPtr, mojom::DeviceInfoPtr>
GetDeviceAndPerformanceInfo() = 0;
protected:
friend class base::RefCountedThreadSafe<Backend>;
Backend() = default;
virtual ~Backend() = default;
};
}
#endif