summaryrefslogtreecommitdiff
path: root/Hutch/Models/Paste.swift
blob: b4c8f18918a6ebd3c9da2d4d0a2ec01792ecaf41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import Foundation

struct PasteFile: Codable, Sendable, Hashable, Identifiable {
    let filename: String?
    let hash: String
    let contents: URL?

    var id: String { hash }
}

struct Paste: Codable, Sendable, Identifiable, Hashable {
    let id: String
    let created: Date
    let visibility: Visibility
    let files: [PasteFile]
    let user: Entity
}

struct PasteUploadDraft: Identifiable, Equatable, Sendable {
    let id: UUID
    var filename: String
    var contents: String

    init(id: UUID = UUID(), filename: String = "", contents: String = "") {
        self.id = id
        self.filename = filename
        self.contents = contents
    }
}