import Foundation
protocol ThumbnailTemplate {
func generate(_ content: [ThumbnailKey : String], shouldIndent: Bool) throws -> String
}
enum ThumbnailKey: String, CaseIterable {
case url = "URL"
case image = "IMAGE"
case image2x = "IMAGE_2X"
case title = "TITLE"
case corner = "CORNER"
}
struct LargeThumbnailTemplate: Template, ThumbnailTemplate {
typealias Key = ThumbnailKey
static let templateName = "thumbnail-large.html"
let raw: String
func makeCorner(text: String) -> String {
"\(text)"
}
func makeTitleSuffix(_ suffix: String) -> String {
"\(suffix)"
}
}
struct SquareThumbnailTemplate: Template, ThumbnailTemplate {
typealias Key = ThumbnailKey
static let templateName = "thumbnail-square.html"
let raw: String
}
struct SmallThumbnailTemplate: Template, ThumbnailTemplate {
typealias Key = ThumbnailKey
static let templateName = "thumbnail-small.html"
let raw: String
}