 import CoreLocation
 import AddressBook
 import AssetsLibrary
+import AVFoundation
 
 public enum PresentDialogResult: String {
     case NoAction = "No Action"

            completion?(granted: true, userDialogResult: .NoAction, systemDialogResult: .NoAction)
        }
    }
}

// MARK: - Photos

    }
}

// MARK - Camera
private extension PresentPrePermissions {
    func showCameraSystemAlert(completion: PermissionCompletionHandler?) {
        AVCaptureDevice.requestAccessForMediaType(AVMediaTypeVideo, completionHandler: { granted in
            self.fireCameraCompletionHandler(completion)
        })
    }
    
    func fireCameraCompletionHandler(completion: PermissionCompletionHandler?) {
        switch AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeVideo) {
        case .NotDetermined:
            completion?(granted: false, userDialogResult: .Denied, systemDialogResult: .NoAction)
        case .Authorized:
            completion?(granted: true, userDialogResult: .Granted, systemDialogResult: .Granted)
        case .Denied:
            completion?(granted: false, userDialogResult: .Granted, systemDialogResult: .Denied)
        case .Restricted:
            completion?(granted: false, userDialogResult: .Granted, systemDialogResult: .Restricted)
        }
    }
    
}
// MARK - Microphone
private extension PresentPrePermissions {
    func showMicrophoneSystemAlert(completion: PermissionCompletionHandler?) {
        AVCaptureDevice.requestAccessForMediaType(AVMediaTypeAudio, completionHandler: { granted in
            self.fireMicrophoneCompletionHandler(completion)
        })
    }
    
    func fireMicrophoneCompletionHandler(completion: PermissionCompletionHandler?) {
        switch AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeAudio) {
        case .NotDetermined:
            completion?(granted: false, userDialogResult: .Denied, systemDialogResult: .NoAction)
        case .Authorized:
            completion?(granted: true, userDialogResult: .Granted, systemDialogResult: .Granted)
        case .Denied:
            completion?(granted: false, userDialogResult: .Granted, systemDialogResult: .Denied)
        case .Restricted:
            completion?(granted: false, userDialogResult: .Granted, systemDialogResult: .Restricted)
        }
    }
}

// ???: Twitter
// ???: Facebook

