import Foundation

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