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