1use schemars::JsonSchema;
2use serde::Deserialize;
3use serde::Serialize;
4use uuid::Uuid;
5
6#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, PartialEq, Eq, Ord, PartialOrd, Hash, ts_rs::TS)]
7pub struct ArtifactId(Uuid);
8
9impl ArtifactId {
10 pub fn new(uuid: Uuid) -> Self {
11 Self(uuid)
12 }
13
14 pub fn placeholder() -> Self {
16 Self(Uuid::nil())
17 }
18}
19
20impl From<Uuid> for ArtifactId {
21 fn from(uuid: Uuid) -> Self {
22 Self::new(uuid)
23 }
24}
25
26impl From<&Uuid> for ArtifactId {
27 fn from(uuid: &Uuid) -> Self {
28 Self::new(*uuid)
29 }
30}
31
32impl From<ArtifactId> for Uuid {
33 fn from(id: ArtifactId) -> Self {
34 id.0
35 }
36}
37
38impl From<&ArtifactId> for Uuid {
39 fn from(id: &ArtifactId) -> Self {
40 id.0
41 }
42}