stint_core/models/
project.rs1use std::path::PathBuf;
4use time::OffsetDateTime;
5
6use super::types::ProjectId;
7
8#[derive(Debug, Clone, PartialEq, Eq)]
10pub enum ProjectStatus {
11 Active,
13 Archived,
15}
16
17impl ProjectStatus {
18 pub fn as_str(&self) -> &'static str {
20 match self {
21 Self::Active => "active",
22 Self::Archived => "archived",
23 }
24 }
25
26 pub fn from_str_value(s: &str) -> Option<Self> {
28 match s {
29 "active" => Some(Self::Active),
30 "archived" => Some(Self::Archived),
31 _ => None,
32 }
33 }
34}
35
36#[derive(Debug, Clone, PartialEq, Eq)]
38pub enum ProjectSource {
39 Manual,
41 Discovered,
43}
44
45impl ProjectSource {
46 pub fn as_str(&self) -> &'static str {
48 match self {
49 Self::Manual => "manual",
50 Self::Discovered => "discovered",
51 }
52 }
53
54 pub fn from_str_value(s: &str) -> Self {
56 match s {
57 "discovered" => Self::Discovered,
58 _ => Self::Manual,
59 }
60 }
61}
62
63#[derive(Debug, Clone, PartialEq)]
65pub struct Project {
66 pub id: ProjectId,
68 pub name: String,
70 pub paths: Vec<PathBuf>,
72 pub tags: Vec<String>,
74 pub hourly_rate_cents: Option<i64>,
76 pub status: ProjectStatus,
78 pub source: ProjectSource,
80 pub created_at: OffsetDateTime,
82 pub updated_at: OffsetDateTime,
84}