// This code is automatically generated by Senax and is always overwritten.

#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unreachable_patterns)]

use ::anyhow::Result;
use ::fxhash::FxHashMap;
use ::indexmap::IndexMap;
use ::senax_common::{cache::msec::MSec, ShardId};
use ::serde::{Deserialize, Serialize};
use ::senax_encoder::{Decode, Encode, Pack, Unpack};
use ::std::path::Path;
use ::std::sync::Arc;
use ::std::time::Duration;

use crate::{DbConn, DELAYED_DB_DIR};

@%- if SEPARATED_BASE_FILES %@
@%- for name in mod_names %@
pub mod @{ name|ident }@;
@%- endfor %@
@%- else %@
@{ table_output }@
@%- endif %@

#[rustfmt::skip]
#[allow(clippy::large_enum_variant)]
#[derive(Decode, Encode, Pack, Unpack, Clone, Debug)]
#[cfg_attr(all(debug_assertions, not(feature = "production_mode")), senax(disable_pack, disable_encode))]
pub enum CacheOp {
@%- for (name, def) in models %@
    @{ name|to_pascal_name }@(@{ def.mod_name()|ident }@::CacheOp),
@%- endfor %@
}

#[rustfmt::skip]
#[cfg_attr(feature = "seed_schema", derive(::schemars::JsonSchema))]
#[cfg_attr(feature = "seed_schema", schemars(deny_unknown_fields))]
#[allow(non_snake_case)]
pub struct @{ group_name|pascal }@ {
@%- for (name, def) in models %@
    #[cfg_attr(feature = "seed_schema", schemars(default))]
    @{ name|ident }@: IndexMap<String, @{ def.mod_name()|ident }@::_@{ name|pascal }@Factory>,
@%- endfor %@
}
@{-"\n"}@