using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

/// <summary>
/// 사용자단 회원 수신, 알림 각종 동의 여부 모음
/// </summary>
namespace Domain.Entities.Members
{
    public class MemberApprove
    {
        [ForeignKey(nameof(MemberID))]
        public virtual Member? Member { get; private set; } = null!;

        [Key]
        public int MemberID { get; set; }

        public bool IsReceiveSMS { get; set; } = false;

        public DateTime? ReceiveSMSConsentAt { get; set; }

        public bool IsReceiveEmail { get; set; } = false;

        public DateTime? ReceiveEmailConsentAt { get; set; }

        public bool IsReceiveNote { get; set; } = false;

        public DateTime? ReceiveNoteConsentAt { get; set; }

        public bool IsDisclosureInvest { get; set; } = false;

        public DateTime? DisclosureInvestConsentAt { get; set; }

        private MemberApprove() { }

        private MemberApprove(int memberID)
        {
            if (memberID <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(memberID));
            }

            MemberID = memberID;
        }

        public static MemberApprove Create(int memberID)
        {
            return new(memberID);
        }
    }
}