1use coil_core::{PlatformModule, RegistrationError, ServiceRegistry};
2use coil_data::MigrationPlan;
3
4use crate::AdminShell;
5
6mod manifest;
7mod migrations;
8mod registration;
9mod shell;
10
11#[derive(Debug, Clone, PartialEq, Eq)]
12pub struct AdminModule {
13 name: String,
14 config_namespace: String,
15 shell: AdminShell,
16}
17
18impl AdminModule {
19 pub fn new() -> Self {
20 Self {
21 name: "admin".to_string(),
22 config_namespace: "admin".to_string(),
23 shell: shell::default_shell(),
24 }
25 }
26
27 pub fn shell(&self) -> &AdminShell {
28 &self.shell
29 }
30}
31
32impl Default for AdminModule {
33 fn default() -> Self {
34 Self::new()
35 }
36}
37
38impl PlatformModule for AdminModule {
39 fn manifest(&self) -> coil_core::ModuleManifest {
40 manifest::build_manifest(self)
41 }
42
43 fn register(&self, registry: &mut ServiceRegistry) -> Result<(), RegistrationError> {
44 registration::register_services(self, registry)
45 }
46
47 fn install_migration_plan(&self) -> Option<MigrationPlan> {
48 migrations::build_migration_plan(self)
49 }
50}