RedditPostModels.swift 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. import Foundation
  2. enum RedditPostType: String, CaseIterable, Identifiable {
  3. case text
  4. case image
  5. case link
  6. case video
  7. case poll
  8. var id: String { rawValue }
  9. var title: String {
  10. switch self {
  11. case .text: "Text"
  12. case .image: "Image"
  13. case .link: "Link"
  14. case .video: "Video"
  15. case .poll: "Poll"
  16. }
  17. }
  18. var subtitle: String {
  19. switch self {
  20. case .text: "Share thoughts & stories"
  21. case .image: "Upload photos & memes"
  22. case .link: "Share articles & URLs"
  23. case .video: "Embed or link videos"
  24. case .poll: "Ask the community"
  25. }
  26. }
  27. var systemImage: String {
  28. switch self {
  29. case .text: "text.alignleft"
  30. case .image: "photo"
  31. case .link: "link"
  32. case .video: "play.rectangle"
  33. case .poll: "chart.bar"
  34. }
  35. }
  36. }
  37. enum PostTone: String, CaseIterable, Identifiable {
  38. case casual
  39. case professional
  40. case humorous
  41. case informative
  42. case controversial
  43. case storytelling
  44. var id: String { rawValue }
  45. var title: String {
  46. switch self {
  47. case .casual: "Casual"
  48. case .professional: "Professional"
  49. case .humorous: "Humorous"
  50. case .informative: "Informative"
  51. case .controversial: "Bold"
  52. case .storytelling: "Storytelling"
  53. }
  54. }
  55. }
  56. enum PollDuration: Int, CaseIterable, Identifiable {
  57. case oneDay = 1
  58. case threeDays = 3
  59. case sevenDays = 7
  60. var id: Int { rawValue }
  61. var label: String {
  62. switch self {
  63. case .oneDay: "1 day"
  64. case .threeDays: "3 days"
  65. case .sevenDays: "7 days"
  66. }
  67. }
  68. }
  69. enum PostGeneratorTab: String, CaseIterable, Identifiable {
  70. case compose
  71. case preview
  72. var id: String { rawValue }
  73. var title: String {
  74. switch self {
  75. case .compose: "Compose"
  76. case .preview: "Preview"
  77. }
  78. }
  79. }
  80. struct PollOption: Identifiable, Equatable {
  81. let id: UUID
  82. var text: String
  83. init(id: UUID = UUID(), text: String = "") {
  84. self.id = id
  85. self.text = text
  86. }
  87. }
  88. struct PostDraft: Equatable {
  89. var postType: RedditPostType = .text
  90. var subreddit: String = ""
  91. var topic: String = ""
  92. var tone: PostTone = .casual
  93. var title: String = ""
  94. var body: String = ""
  95. var linkURL: String = ""
  96. var videoURL: String = ""
  97. var imageFileURL: URL?
  98. var pollOptions: [PollOption] = [
  99. PollOption(text: ""),
  100. PollOption(text: ""),
  101. ]
  102. var pollDuration: PollDuration = .threeDays
  103. var isNSFW: Bool = false
  104. var isSpoiler: Bool = false
  105. var isOC: Bool = false
  106. var flair: String = ""
  107. }
  108. struct GeneratedPost: Equatable {
  109. var title: String
  110. var body: String
  111. var suggestedFlair: String?
  112. }