package top.imwork.window.silos.processor;

import java.time.LocalDateTime;

public class Chapter {
    private String title;
    private String content;
    private int chapterNumber;
    private LocalDateTime processedTime;
    private int wordCount;

    public Chapter(String title, String content, int chapterNumber) {
        this.title = title;
        this.content = content;
        this.chapterNumber = chapterNumber;
        this.processedTime = LocalDateTime.now();
        this.wordCount = content.split("\\s+").length;
    }

    // Getter 和 Setter 方法
    public String getTitle() { return title; }
    public void setTitle(String title) { this.title = title; }

    public String getContent() { return content; }
    public void setContent(String content) { this.content = content; }

    public int getChapterNumber() { return chapterNumber; }
    public void setChapterNumber(int chapterNumber) { this.chapterNumber = chapterNumber; }

    public LocalDateTime getProcessedTime() { return processedTime; }
    public void setProcessedTime(LocalDateTime processedTime) { this.processedTime = processedTime; }

    public int getWordCount() { return wordCount; }

    @Override
    public String toString() {
        return String.format("第%d章: %s (字数: %d, 处理时间: %s)",
                chapterNumber, title, wordCount, processedTime);
    }
}