package com.devsoap.tincheck.tin;

import java.util.Arrays;

public interface TinCountry extends TinValidator, TinGenerator, Comparable<TinCountry> {

    String getCountryCode();

    String getCountryName();

    default int[] extractDigits(String tin) {
        return Arrays.stream(tin.split(""))
                .mapToInt(c -> Integer.parseUnsignedInt(String.valueOf(c)))
                .toArray();
    }

    @Override
    default int compareTo(TinCountry o) {
        return getCountryCode().compareTo(o.getCountryCode());
    }
}