fiberplane_models/providers/schema/fields/
label_field.rs1#[cfg(feature = "fp-bindgen")]
2use fp_bindgen::prelude::Serializable;
3use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
12#[cfg_attr(
13 feature = "fp-bindgen",
14 derive(Serializable),
15 fp(rust_module = "fiberplane_models::providers")
16)]
17#[non_exhaustive]
18#[serde(rename_all = "camelCase")]
19pub struct LabelField {
20 pub name: String,
23
24 pub label: String,
27
28 pub multiple: bool,
30
31 pub placeholder: String,
33
34 pub required: bool,
36}
37
38impl LabelField {
39 pub fn new() -> Self {
41 Default::default()
42 }
43
44 pub fn multiple(self) -> Self {
46 Self {
47 multiple: true,
48 ..self
49 }
50 }
51
52 pub fn required(self) -> Self {
54 Self {
55 required: true,
56 ..self
57 }
58 }
59
60 pub fn with_label(self, label: impl Into<String>) -> Self {
61 Self {
62 label: label.into(),
63 ..self
64 }
65 }
66
67 pub fn with_name(self, name: impl Into<String>) -> Self {
68 Self {
69 name: name.into(),
70 ..self
71 }
72 }
73
74 pub fn with_placeholder(self, placeholder: impl Into<String>) -> Self {
75 Self {
76 placeholder: placeholder.into(),
77 ..self
78 }
79 }
80}