Skip to main content

hyperlane_cli/template/
enum.rs

1/// Types of template components that can be generated
2#[derive(Clone, Copy, Debug, Eq, PartialEq)]
3pub enum TemplateType {
4    /// Controller component for handling HTTP requests
5    Controller,
6    /// Domain component for business logic encapsulation
7    Domain,
8    /// Exception component for error handling
9    Exception,
10    /// Mapper component for data transformation
11    Mapper,
12    /// Model component for data structures
13    Model,
14    /// Repository component for data access
15    Repository,
16    /// Service component for business services
17    Service,
18    /// Utils component for utility functions
19    Utils,
20    /// View component for presentation layer
21    View,
22}
23
24/// Model subtypes for organizing data structures
25#[derive(Clone, Copy, Debug, Eq, PartialEq)]
26pub enum ModelSubType {
27    /// Application model for internal use
28    Application,
29    /// Request model for input validation
30    Request,
31    /// Response model for API responses
32    Response,
33}
34
35/// Errors that can occur during template generation
36#[derive(Debug, thiserror::Error)]
37pub enum TemplateError {
38    /// IO error occurred
39    #[error("IO error: {0}")]
40    IoError(#[from] std::io::Error),
41    /// Invalid template type
42    #[error("Invalid template type: {0}")]
43    InvalidTemplateType(String),
44    /// Invalid model subtype
45    #[error("Invalid model subtype: {0}")]
46    InvalidModelSubType(String),
47    /// Directory already exists
48    #[error("Directory '{0}' already exists")]
49    DirectoryExists(String),
50}