import Foundation

public class PlateNumber {
	private var number: String
	private var numberEnglish: String
	
	public init(_ string: String) {
		self.number = string
		self.numberEnglish = String(self.number.map { Constants.pnLettersMap[$0] ?? $0 })
	}
	
	public func asString() -> String {
		return self.number
	}
	
	public func mainPart() -> String {
        let index = self.numberEnglish.index(self.numberEnglish.startIndex, offsetBy: 6)
		return String(self.numberEnglish[..<index])
	}
	
	public func region() -> String {
		let index = self.numberEnglish.index(self.numberEnglish.startIndex, offsetBy: 6)
		return String(self.numberEnglish[index...])
	}
}
