//
//  MIKMIDIErrors.h
//  Danceability
//
//  Created by Andrew Madsen on 7/19/13.
//  Copyright (c) 2013 Mixed In Key. All rights reserved.
//

#import <Foundation/Foundation.h>

/**
 *  Error domain for errors generated by MIKMIDI.
 */
extern NSString * const MIKMIDIErrorDomain;

/**
 *  Error code values for NSError objects in the MIKMIDI error domain.
 */
typedef NS_ENUM(NSInteger, MIKMIDIErrorCode) {
	/**
	 *  Unknown error.
	 */
	MIKMIDIUnknownErrorCode = 1,
	/**
	 *  An error occurred because the connection to a device was lost.
	 */
	MIKMIDIDeviceConnectionLostErrorCode,
	/**
	 *  An connection error occurred because the device has no source endpoints.
	 */
	MIKMIDIDeviceHasNoSourcesErrorCode,
	/**
	 *  MIDI mapping using MIKMIDIMappingGenerator failed.
	 */
	MIKMIDIMappingFailedErrorCode,
	/**
	 *  The mapping file did not have the correct file extension (".midimap").
	 */
	MIKMIDIMappingIncorrectFileExtensionErrorCode,
};

/**
 *  Category to ease creation of NSError instances in the MIKMIDI error domain.
 */
@interface NSError (MIKMIDI)

/**
 *  Creates an NSError instance whose domain is MIKMIDIErrorDomain.
 *
 *  @param code     An error code. Should be one of the values defined for MIKMIDIErrorCode.
 *  @param userInfo A user info dictionary. Can pass nil.
 *
 *  @return An initialized NSError instance whose domain is MIKMIDIErrorDomain.
 */
+ (instancetype)MIKMIDIErrorWithCode:(MIKMIDIErrorCode)code userInfo:(NSDictionary *)userInfo;

@end