idiolect-records 0.1.0

Rust record types mirroring the dev.idiolect.* Lexicon family.
Documentation
// @generated by idiolect-codegen. do not edit.
// source: dev.idiolect.bounty

//! A declaration that a translation, verification, or adapter is wanted, with terms. Per P5, the project does not intermediate fulfillment: payment, review, and acceptance happen on external rails referenced here.

#![allow(
    missing_docs,
    clippy::doc_markdown,
    clippy::struct_excessive_bools,
    clippy::derive_partial_eq_without_eq
)]
use serde::{Deserialize, Serialize};

/// A request primitive. Someone states what they want (a lens, a verification, an adapter) and the terms under which they will consider it delivered; fulfillment is resolved off-substrate.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Bounty {
    /// Free-text constraints: performance targets, conformance requirements, licensing, deadlines.
    pub constraints: String,
    /// Who may claim this bounty. Free text; enforcement is off-substrate.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub eligibility: Option<String>,
    /// Once fulfilled, points to the deliverable record (lens, verification, or adapter).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub fulfillment: Option<String>,
    pub occurred_at: String,
    pub requester: String,
    /// Free-form reward terms. The bounty record does not transact; it references external rails.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub reward: Option<BountyReward>,
    /// Current lifecycle state as declared by the requester.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<BountyStatus>,
    /// What is being requested. Exactly one of: a lens between two schemas, a verification of a lens, or an adapter for a framework.
    pub wants: BountyWants,
}

impl crate::Record for Bounty {
    const NSID: &'static str = "dev.idiolect.bounty";
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct WantAdapter {
    pub framework: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub version_range: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct WantLens {
    /// Whether the requested lens must be invertible.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub bidirectional: Option<bool>,
    pub source: super::defs::SchemaRef,
    pub target: super::defs::SchemaRef,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct WantVerification {
    pub kind: WantVerificationKind,
    pub lens: super::defs::LensRef,
}

/// WantVerificationKind.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum WantVerificationKind {
    RoundtripTest,
    PropertyTest,
    FormalProof,
    ConformanceTest,
    StaticCheck,
    ConvergencePreserving,
}

/// BountyWants tagged union.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum BountyWants {
    #[serde(rename = "dev.idiolect.bounty#wantLens")]
    WantLens(WantLens),
    #[serde(rename = "dev.idiolect.bounty#wantVerification")]
    WantVerification(WantVerification),
    #[serde(rename = "dev.idiolect.bounty#wantAdapter")]
    WantAdapter(WantAdapter),
}

/// BountyStatus.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum BountyStatus {
    Open,
    Claimed,
    Fulfilled,
    Withdrawn,
}

/// Free-form reward terms. The bounty record does not transact; it references external rails.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BountyReward {
    /// URL pointing to the rail that handles actual reward (grant portal, payment platform, attestation service).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub external_ref: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub summary: Option<String>,
}