2022-11-20 15:39:06 +00:00
|
|
|
import Foundation
|
|
|
|
|
2022-12-16 12:16:48 +00:00
|
|
|
public protocol AnyStatus {
|
|
|
|
var id: String { get }
|
|
|
|
var content: String { get }
|
|
|
|
var account: Account { get }
|
|
|
|
var createdAt: String { get }
|
2022-12-17 12:37:46 +00:00
|
|
|
var mediaAttachments: [MediaAttachement] { get }
|
2022-12-19 14:51:25 +00:00
|
|
|
var mentions: [Mention] { get }
|
2022-12-19 15:17:25 +00:00
|
|
|
var repliesCount: Int { get }
|
|
|
|
var reblogsCount: Int { get }
|
|
|
|
var favouritesCount: Int { get }
|
2022-12-16 12:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public struct Status: AnyStatus, Codable, Identifiable {
|
|
|
|
public let id: String
|
2022-12-17 12:37:46 +00:00
|
|
|
public let content: HTMLString
|
2022-12-16 12:16:48 +00:00
|
|
|
public let account: Account
|
2022-12-17 12:37:46 +00:00
|
|
|
public let createdAt: ServerDate
|
2022-12-16 12:16:48 +00:00
|
|
|
public let reblog: ReblogStatus?
|
2022-12-17 12:37:46 +00:00
|
|
|
public let mediaAttachments: [MediaAttachement]
|
2022-12-19 14:51:25 +00:00
|
|
|
public let mentions: [Mention]
|
2022-12-19 15:17:25 +00:00
|
|
|
public let repliesCount: Int
|
|
|
|
public let reblogsCount: Int
|
|
|
|
public let favouritesCount: Int
|
2022-12-17 12:37:46 +00:00
|
|
|
|
|
|
|
public static func placeholder() -> Status {
|
|
|
|
.init(id: UUID().uuidString,
|
|
|
|
content: "Some post content\n Some more post content \n Some more",
|
|
|
|
account: .placeholder(),
|
|
|
|
createdAt: "2022-12-16T10:20:54.000Z",
|
|
|
|
reblog: nil,
|
2022-12-19 14:51:25 +00:00
|
|
|
mediaAttachments: [],
|
2022-12-19 15:17:25 +00:00
|
|
|
mentions: [],
|
|
|
|
repliesCount: 0,
|
|
|
|
reblogsCount: 0,
|
|
|
|
favouritesCount: 0)
|
2022-12-17 12:37:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static func placeholders() -> [Status] {
|
|
|
|
[.placeholder(), .placeholder(), .placeholder(), .placeholder(), .placeholder()]
|
|
|
|
}
|
2022-12-16 12:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public struct ReblogStatus: AnyStatus, Codable, Identifiable {
|
2022-11-20 15:39:06 +00:00
|
|
|
public let id: String
|
|
|
|
public let content: String
|
|
|
|
public let account: Account
|
2022-11-25 11:00:01 +00:00
|
|
|
public let createdAt: String
|
2022-12-17 12:37:46 +00:00
|
|
|
public let mediaAttachments: [MediaAttachement]
|
2022-12-19 14:51:25 +00:00
|
|
|
public let mentions: [Mention]
|
2022-12-19 15:17:25 +00:00
|
|
|
public let repliesCount: Int
|
|
|
|
public let reblogsCount: Int
|
|
|
|
public let favouritesCount: Int
|
2022-11-20 15:39:06 +00:00
|
|
|
}
|