 //
 
 import Foundation
+import BigInt
 
 public typealias Byte = UInt8
 

}

public enum Nucleotide: Byte, CharConvertible, Equatable {
    case a = 0
    case c = 1
    case g = 2
    case t = 3
    
    public var charValue: Character {
        switch self {

        case .t:
            return "T"
        }
    }

    var bigIntValue: BigInt {
        return BigInt(integerLiteral: Int64(self.rawValue))
    }
    
    public static let componentCount: BigInt = 4
    
    internal static var all: [Nucleotide] {
        return [ .a, .c, .g, .t ]
    }
    
    public static var random: Nucleotide {
        return Nucleotide.all[Int(arc4random()) % Int(componentCount)]
    }

    public init?(unit: CharConvertible) {
