package com.devsoap.tincheck.tin;

import io.micronaut.core.util.StringUtils;

public interface TinValidator {

    default String cleanTin(String tin) {
        return tin.replace(" ", "");
    }

    default boolean validate(String tin){
        String strippedTin = cleanTin(tin);
        return basicCheck(strippedTin) && formatCheck(strippedTin) && logicCheck(strippedTin);
    }

    default boolean basicCheck(String tin) {
        return StringUtils.hasText(tin);
    }

    default boolean formatCheck(String tin){
        return true;
    }

    default boolean logicCheck(String tin){
        return true;
    }
}