package com.devsoap.tincheck.countries;

import com.devsoap.tincheck.tin.TinCountry;
import jakarta.inject.Singleton;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

import java.time.LocalDate;
import java.util.Random;
import java.util.stream.Collectors;

@Getter
@Singleton
@RequiredArgsConstructor
@ToString(of = {"countryCode", "countryName"})
public class Country_GR implements TinCountry {

    private final String countryCode = "GR";
    private final String countryName = "Greece";

    @Override
    public String generate(LocalDate yearOfBirth, Gender gender, Random randomGenerator) {
        return randomGenerator.ints(9,0,10)
                .mapToObj(String::valueOf)
                .collect(Collectors.joining());
    }

    @Override
    public boolean formatCheck(String tin) {
        return tin.length() == 9 && StringUtils.isNumeric(tin);
    }
}