using System;
using System.Collections.Generic;
using System.Text;

namespace KiMailOrderAgent.Storage;

public class ProcessedMailStore
{
    private readonly string _filePath = "processed_mails.txt";

    public bool IsProcessed(string mailId)
    {
        if (!File.Exists(_filePath))
            return false;

        return File.ReadAllLines(_filePath).Contains(mailId);
    }

    public void MarkAsProcessed(string mailId)
    {
        if (string.IsNullOrWhiteSpace(mailId))
            return;

        if (IsProcessed(mailId))
            return;

        File.AppendAllLines(_filePath, new[] { mailId });
    }
}
