use serde::{Serialize, de::DeserializeOwned};

use crate::manifests::{Action, ManifestState};

pub trait Specification: Clone + Serialize + DeserializeOwned {
    fn kind(&self) -> &'static str;
}

#[allow(dead_code, unused_variables)]
pub trait Operator: Send + Sync + 'static {
    type Specifications: Specification;
    type Error;

    fn reconcile(
        &self,
        desired_manifest: &mut ManifestState<Self::Specifications>,
    ) -> impl Future<Output = Result<Action, Self::Error>>;

    fn on_error(
        &self,
        desired_manifest: &mut ManifestState<Self::Specifications>,
        error: &Self::Error,
    ) -> impl Future<Output = Action> {
        async { Action::None }
    }
}
