package com.devsoap.tincheck;

import com.github.jknack.handlebars.Handlebars;
import com.github.jknack.handlebars.helper.ConditionalHelpers;
import com.github.jknack.handlebars.helper.EachHelper;
import com.github.jknack.handlebars.helper.StringHelpers;
import io.micronaut.context.annotation.Factory;
import io.micronaut.context.annotation.Replaces;
import jakarta.inject.Singleton;

import java.util.Random;

@Factory
public class ApplicationConfiguration {

    @Singleton
    public Random randomGenerator() {
        return new Random();
    }

    @Singleton
    @Replaces(Handlebars.class)
    public Handlebars handlebars() {
        return new Handlebars()
                .registerHelpers(StringHelpers.class)
                .registerHelpers(EachHelper.class)
                .registerHelpers(ConditionalHelpers.class);
    }
}