1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use holo_hash::AgentPubKey;
use holo_hash::AnyDhtHash;
use holochain_serialized_bytes::prelude::*;

use crate::chain::ChainFilter;

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, SerializedBytes)]
pub enum ValidateCallbackResult {
    Valid,
    Invalid(String),
    /// Subconscious needs to map this to either pending or abandoned based on context that the
    /// wasm can't possibly have.
    UnresolvedDependencies(UnresolvedDependencies),
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
/// Unresolved dependencies that are either a set of hashes
/// or an agent activity query.
pub enum UnresolvedDependencies {
    Hashes(Vec<AnyDhtHash>),
    AgentActivity(AgentPubKey, ChainFilter),
}

/// The level of validation package required by
/// an entry.
#[derive(
    Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Serialize, serde::Deserialize,
)]
pub enum RequiredValidationType {
    /// Just the record (default)
    Record,
    /// All chain items of the same entry type
    SubChain,
    /// The entire chain
    Full,
}

impl Default for RequiredValidationType {
    fn default() -> Self {
        Self::Record
    }
}