//
//  Attachment.swift
//  Pachyderm
//
//  Created by Shadowfacts on 9/8/18.
//  Copyright © 2018 Shadowfacts. All rights reserved.
//

import Foundation

public struct FormAttachment: Sendable {
    let mimeType: String
    let data: Data
    let fileName: String
    
    public init(mimeType: String, data: Data, fileName: String) {
        self.mimeType = mimeType
        self.data = data
        self.fileName = fileName
    }
}

extension FormAttachment {
    public init(jepgData data: Data, fileName: String = "file.jpg") {
        self.init(mimeType: "image/jpg", data: data, fileName: fileName)
    }
    
    public init(pngData data: Data, fileName: String = "file.png") {
        self.init(mimeType: "image/png", data: data, fileName: fileName)
    }
    
    public init(gifData data: Data, fileName: String = "file.gif") {
        self.init(mimeType: "image/gif", data: data, fileName: fileName)
    }
}
