IceCubesApp/Packages/Models/Sources/Models/MediaAttachement.swift

32 lines
695 B
Swift
Raw Normal View History

2022-12-17 12:37:46 +00:00
import Foundation
2022-12-27 05:44:40 +00:00
public struct MediaAttachement: Codable, Identifiable, Hashable {
public struct MetaContainer: Codable, Equatable {
public struct Meta: Codable, Equatable {
public let width: Int?
public let height: Int?
}
2023-01-17 10:36:01 +00:00
2023-01-05 12:27:04 +00:00
public let original: Meta?
2022-12-27 05:44:40 +00:00
}
2023-01-17 10:36:01 +00:00
2022-12-19 15:01:23 +00:00
public enum SupportedType: String {
case image, gifv, video, audio
2022-12-19 15:01:23 +00:00
}
2023-01-17 10:36:01 +00:00
2022-12-19 18:04:07 +00:00
public func hash(into hasher: inout Hasher) {
hasher.combine(id)
}
2023-01-17 10:36:01 +00:00
2022-12-17 12:37:46 +00:00
public let id: String
public let type: String
2022-12-19 15:01:23 +00:00
public var supportedType: SupportedType? {
SupportedType(rawValue: type)
}
2023-01-17 10:36:01 +00:00
2022-12-27 15:16:25 +00:00
public let url: URL?
2022-12-21 11:39:29 +00:00
public let previewUrl: URL?
2022-12-17 12:37:46 +00:00
public let description: String?
2022-12-27 05:44:40 +00:00
public let meta: MetaContainer?
2022-12-17 12:37:46 +00:00
}