namespace bitforum.Constants
{
    public class TemplateKey
    {
        public string Name { get; }
        public string Subject { get; }
        public string Content { get; }

        public TemplateKey(string name, string subject, string content)
        {
            Name = name;
            Subject = subject;
            Content = content;
        }
    }

    public static class Template
    {
        public static readonly TemplateKey RegisterEmailForm = new("회원가입 시", "register_email_form_title", "register_email_form_content");
        public static readonly TemplateKey RegistrationEmailForm = new("회원가입 완료", "registration_email_form_title", "registration_email_form_content");
        public static readonly TemplateKey ForgotPasswordEmailForm = new("비밀번호 재설정", "forgot_password_email_form_title", "forgot_password_email_form_content");
        public static readonly TemplateKey ChangedPasswordEmailForm = new("비밀번호 변경 완료", "changed_password_email_form_title", "changed_password_email_form_content");
        public static readonly TemplateKey WithdrawEmailForm = new("회원탈퇴 시", "withdraw_email_form_title", "withdraw_email_form_content");
        public static readonly TemplateKey EmailVerifyForm = new("이메일 변경 시", "email_verify_form_title", "email_verify_form_content");
        public static readonly TemplateKey ChangedEmailForm = new("이메일 변경 완료", "changed_email_form_title", "changed_email_form_content");
    }

    public interface IPlaceholder
    {
        Dictionary<string, string> ToDictionary();
    }

    public class Placeholders : IPlaceholder
    {
        private readonly Dictionary<string, string> _data = new();

        private Placeholders() { } // 생성자 직접 호출 방지

        // 회원가입 시
        public static Placeholders RegisterEmailForm(string email, string code) => new Placeholders { _data = { ["email"] = email, ["code"] = code } };

        // 회원가입 수락
        public static Placeholders RegistrationEmailForm(string email, string createdAt) => new Placeholders { _data = { ["email"] = email, ["createdAt"] = createdAt } };

        // 비밀번호 재설정
        public static Placeholders ForgotPasswordEmailForm(string email, string code) => new Placeholders { _data = { ["email"] = email, ["code"] = code } };

        // 비밀번호 변경 완료
        public static Placeholders ChangedPasswordEmailForm(string email, string createdAt) => new Placeholders { _data = { ["email"] = email, ["createdAt"] = createdAt } };

        // 회원탈퇴 시
        public static Placeholders WithdrawEmailForm(string email, string reason, string createdAt) => new Placeholders { _data = { ["email"] = email, ["reason"] = reason, ["createdAt"] = createdAt } };

        // 이메일 변경 시
        public static Placeholders EmailVerifyForm(string email, string link) => new Placeholders { _data = { ["email"] = email, ["link"] = link } };

        // 이메일 변경 완료
        public static Placeholders ChangedEmailForm(string email, string createdAt) => new Placeholders { _data = { ["email"] = email, ["createdAt"] = createdAt } };

        public Dictionary<string, string> ToDictionary() => _data;
    }
}
