reinhardt_admin/types/
models.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct ModelInfo {
8 pub name: String,
10 pub list_url: String,
12}
13
14#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct FieldInfo {
17 pub name: String,
19 pub label: String,
21 pub field_type: FieldType,
23 pub required: bool,
25 pub readonly: bool,
27 pub help_text: Option<String>,
29 pub placeholder: Option<String>,
31}
32
33#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
35#[serde(tag = "type", content = "options")]
36pub enum FieldType {
37 Text,
39 TextArea,
41 Number,
43 Boolean,
45 Email,
47 Date,
49 DateTime,
51 Select { choices: Vec<(String, String)> },
53 MultiSelect { choices: Vec<(String, String)> },
55 File,
57 Hidden,
59}
60
61#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
63#[serde(tag = "type", content = "options")]
64pub enum FilterType {
65 Boolean,
67 Choice { choices: Vec<FilterChoice> },
69 DateRange { ranges: Vec<FilterChoice> },
71 NumberRange { ranges: Vec<FilterChoice> },
73}
74
75#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
77pub struct FilterChoice {
78 pub value: String,
80 pub label: String,
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize)]
86pub struct FilterInfo {
87 pub field: String,
89 pub title: String,
91 pub filter_type: FilterType,
93 pub current_value: Option<String>,
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
99pub struct ColumnInfo {
100 pub field: String,
102 pub label: String,
104 pub sortable: bool,
106}