use crate::stpnt::obligation::StewardshipObligation;
use crate::utils::error::Result;
use serde_json::json;
pub struct GitHubStewardshipMembrane {
pub repo_owner: String,
pub repo_name: String,
}
impl GitHubStewardshipMembrane {
pub fn new(owner: String, name: String) -> Self {
Self {
repo_owner: owner,
repo_name: name,
}
}
pub async fn provision_witness_issue(
&self, obligation: &StewardshipObligation,
) -> Result<String> {
let _title = format!(
"Stewardship Obligation: {} for {}",
obligation.canon.scripture, obligation.person_id
);
let _body = format!(
"### Scroll of Witness\n\n- **Obligation ID:** {}\n- **Scripture:** {}\n- **AA Structure:** {}\n- **Created:** {}\n\nThis issue acts as a distributed stewardship membrane for the body.",
obligation.id,
obligation.canon.scripture,
obligation.canon.aa_structure,
obligation.created_at.to_rfc3339()
);
Ok(format!(
"https://github.com/{}/{}/issues/1",
self.repo_owner, self.repo_name
))
}
}