Skip to main content

paperless_api/metadata/
document_type.rs

1//! Types related to document types.
2
3use serde::{Deserialize, Serialize};
4
5use paperless_api_macros::{CreateDto, Item, UpdateDto};
6
7use super::MatchAlgorithm;
8use super::permission::ItemPermissions;
9
10/// A document type.
11#[derive(Debug, Clone, Deserialize, Serialize, CreateDto, UpdateDto, Item)]
12pub struct DocumentType {
13    /// Unique identifier of the document type.
14    #[dto(skip)]
15    pub id: crate::id::DocumentTypeId,
16
17    /// Slug of the document type.
18    #[dto(skip)]
19    pub slug: String,
20
21    /// Name of the document type.
22    pub name: String,
23
24    /// Matching pattern for the document type.
25    #[serde(rename = "match")]
26    pub match_pattern: String,
27
28    /// Matching algorithm for the document type.
29    pub matching_algorithm: MatchAlgorithm,
30
31    /// Whether the document type matching is case-insensitive.
32    pub is_insensitive: Option<bool>,
33
34    /// Number of documents with this type.
35    #[dto(skip)]
36    #[serde(default)]
37    pub document_count: u32,
38
39    /// Owner of the document type.
40    pub owner: Option<crate::id::UserId>,
41
42    /// The permissions for this document type.
43    #[dto(skip)]
44    #[serde(flatten)]
45    pub permissions: ItemPermissions,
46}