package io.gmss.fiscad.service;

import org.springframework.stereotype.Service;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.UUID;

@Service
public class StringService {

    public String getUniqueString() {
        UUID uuid = UUID.randomUUID();
        String uuidAsString = uuid.toString();
        return uuidAsString.replaceAll("-", "");
    }

    public static String getCodeEquipe() {
        UUID uuid = UUID.randomUUID();
        String uuidAsString = uuid.toString();
        return uuidAsString.replaceAll("-", "").toUpperCase().substring(0, 4);
    }

    public String generateIntInTwoPositions(int input) {
        NumberFormat formatter = new DecimalFormat("00");
        return formatter.format(input);
    }

    public String generateIntInThrePositions(int input) {
        NumberFormat formatter = new DecimalFormat("000");
        return formatter.format(input);
    }
}
