<commit_before>//
//  FileService.swift
//  Photostream
//
//  Created by <NAME> on 17/08/2016.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation

protocol FileService {

    init(session: AuthSession)
    
    func uploadJPEGImage(data: FileServiceImageUploadData, track: ((Progress?) -> Void)?, callback: ((FileServiceResult) -> Void)?)
}

protocol FileServiceUploadData {
    
    var id: String? { set get }
    var data: Data? { set get }
}

struct FileServiceImageUploadData: FileServiceUploadData {
    
    var id: String?
    var data: Data?
    var width: Float = 0
    var height: Float = 0
}

struct FileServiceResult {
    
    var uploadId: String?
    var fileId: String?
    var fileUrl: String?
    var error: FileServiceError?
}

enum FileServiceError: Error {
    
    case authenticationNotFound(message: String)
    case failedToUpload(message: String)
    case noDataToUpload(message: String)
    
    var message: String {<commit_msg>Added uploading of avatar image.<commit_after>//
//  FileService.swift
//  Photostream
//
//  Created by <NAME> on 17/08/2016.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation

protocol FileService {

    init(session: AuthSession)
    
    func uploadJPEGImage(data: FileServiceImageUploadData, track: ((Progress?) -> Void)?, callback: ((FileServiceResult) -> Void)?)
    
    func uploadAvatarImage(data: FileServiceImageUploadData, track: ((Progress?) -> Void)?, callback: ((FileServiceResult) -> Void)?)
}

protocol FileServiceUploadData {
    
    var id: String? { set get }
    var data: Data? { set get }
}

struct FileServiceImageUploadData: FileServiceUploadData {
    
    var id: String?
    var data: Data?
    var width: Float = 0
    var height: Float = 0
}

struct FileServiceResult {
    
    var uploadId: String?
    var fileId: String?
    var fileUrl: String?
    var error: FileServiceError?
}

enum FileServiceError: Error {
    
    case authenticationNotFound(message: String)
    case failedToUpload(message: String)
    case noDataToUpload(message: String)
    
    var message: String {
{'fraction_non_alphanumeric': 0.10444234404536862, 'fraction_numerical': 0.013232514177693762, 'mean_word_length': 3.2003968253968256, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1552925', 'n_tokens_mistral': 661, 'n_tokens_neox': 624, 'n_words': 189}