2022-12-19 11:28:55 +00:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
public struct Notification: Codable, Identifiable {
|
2023-01-04 07:14:37 +00:00
|
|
|
public enum NotificationType: String, CaseIterable {
|
2022-12-19 11:28:55 +00:00
|
|
|
case follow, follow_request, mention, reblog, status, favourite, poll, update
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-19 11:28:55 +00:00
|
|
|
public let id: String
|
|
|
|
public let type: String
|
|
|
|
public let createdAt: ServerDate
|
|
|
|
public let account: Account
|
|
|
|
public let status: Status?
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-19 11:28:55 +00:00
|
|
|
public var supportedType: NotificationType? {
|
|
|
|
.init(rawValue: type)
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-19 11:28:55 +00:00
|
|
|
public static func placeholder() -> Notification {
|
|
|
|
.init(id: UUID().uuidString,
|
|
|
|
type: NotificationType.favourite.rawValue,
|
|
|
|
createdAt: "2022-12-16T10:20:54.000Z",
|
|
|
|
account: .placeholder(),
|
|
|
|
status: .placeholder())
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-19 11:28:55 +00:00
|
|
|
public static func placeholders() -> [Notification] {
|
2022-12-21 16:39:48 +00:00
|
|
|
[.placeholder(), .placeholder(), .placeholder(), .placeholder(), .placeholder(), .placeholder(), .placeholder(), .placeholder()]
|
2022-12-19 11:28:55 +00:00
|
|
|
}
|
|
|
|
}
|