/*
 *  Copyright (c) 2025 John Ahlroos / Devsoap
 *
 *  Creative Commons Attribution-NoDerivatives 4.0 International Public License
 *
 *  By exercising the Licensed Rights (defined below), You accept and agree
 *  to be bound by the terms and conditions of this Creative Commons
 *  Attribution-NoDerivatives 4.0 International Public License ("Public
 *  License"). To the extent this Public License may be interpreted as a
 *  contract, You are granted the Licensed Rights in consideration of Your
 *  acceptance of these terms and conditions, and the Licensor grants You
 *  such rights in consideration of benefits the Licensor receives from
 *  making the Licensed Material available under these terms and
 *  conditions.
 *
 *  Refer to LICENSE file or https://creativecommons.org/licenses/by-nd/4.0 for full license.
 *
 */

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());
    }
}