package com.storycove.service;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class ReadingTimeService {
    
    @Value("${app.reading.speed.default:200}")
    private int defaultWordsPerMinute;
    
    /**
     * Calculate estimated reading time in minutes for the given word count
     * @param wordCount the number of words to read
     * @return estimated reading time in minutes (minimum 1 minute)
     */
    public int calculateReadingTime(int wordCount) {
        return Math.max(1, wordCount / defaultWordsPerMinute);
    }
    
    /**
     * Get the current words per minute setting
     * @return words per minute reading speed
     */
    public int getWordsPerMinute() {
        return defaultWordsPerMinute;
    }
}