| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- using Domain.Entities.Developers.ValueObject;
- using Domain.Entities.Members;
- namespace Domain.Entities.Developers;
- /// <summary>
- /// 개발자 포털 가입 법인 정보 (Member 1:1).
- /// API 키 사용 회사의 회사정보 + 본인인증/승인 상태 메타.
- /// </summary>
- public class Developer
- {
- [ForeignKey(nameof(MemberID))]
- public virtual Member? Member { get; private set; }
- [Key]
- public int ID { get; private set; }
- public int MemberID { get; private set; }
- public string CompanyName { get; private set; } = default!;
- public string BusinessNumber { get; private set; } = default!;
- public string CeoName { get; private set; } = default!;
- public string ContactName { get; private set; } = default!;
- public string ContactPhone { get; private set; } = default!;
- public KycStatus KycStatus { get; private set; } = KycStatus.None;
- public string? KycCi { get; private set; }
- public string? KycDi { get; private set; }
- public DateTime? KycVerifiedAt { get; private set; }
- public DeveloperApprovalStatus ApprovalStatus { get; private set; } = DeveloperApprovalStatus.Pending;
- public string? ApprovalReason { get; private set; }
- public DateTime? ApprovedAt { get; private set; }
- public string? ApprovedByAdminID { get; private set; }
- public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
- public DateTime? UpdatedAt { get; private set; }
- private Developer() { }
- public static Developer Create(
- int memberID,
- string companyName,
- string businessNumber,
- string ceoName,
- string contactName,
- string contactPhone
- ) {
- if (string.IsNullOrWhiteSpace(companyName))
- {
- throw new ArgumentException("Company name is required.", nameof(companyName));
- }
- if (string.IsNullOrWhiteSpace(businessNumber))
- {
- throw new ArgumentException("Business number is required.", nameof(businessNumber));
- }
- if (string.IsNullOrWhiteSpace(ceoName))
- {
- throw new ArgumentException("CEO name is required.", nameof(ceoName));
- }
- if (string.IsNullOrWhiteSpace(contactName))
- {
- throw new ArgumentException("Contact name is required.", nameof(contactName));
- }
- if (string.IsNullOrWhiteSpace(contactPhone))
- {
- throw new ArgumentException("Contact phone is required.", nameof(contactPhone));
- }
- return new Developer
- {
- MemberID = memberID,
- CompanyName = companyName,
- BusinessNumber = businessNumber,
- CeoName = ceoName,
- ContactName = contactName,
- ContactPhone = contactPhone
- };
- }
- public void UpdateCompanyInfo(
- string companyName,
- string businessNumber,
- string ceoName,
- string contactName,
- string contactPhone
- ) {
- CompanyName = companyName;
- BusinessNumber = businessNumber;
- CeoName = ceoName;
- ContactName = contactName;
- ContactPhone = contactPhone;
- UpdatedAt = DateTime.UtcNow;
- }
- public void MarkKycPending()
- {
- KycStatus = KycStatus.Pending;
- UpdatedAt = DateTime.UtcNow;
- }
- public void MarkKycVerified(string? ci, string? di)
- {
- KycStatus = KycStatus.Verified;
- KycCi = ci;
- KycDi = di;
- KycVerifiedAt = DateTime.UtcNow;
- UpdatedAt = DateTime.UtcNow;
- }
- public void MarkKycRejected()
- {
- KycStatus = KycStatus.Rejected;
- UpdatedAt = DateTime.UtcNow;
- }
- public void Approve(string adminID)
- {
- ApprovalStatus = DeveloperApprovalStatus.Approved;
- ApprovalReason = null;
- ApprovedAt = DateTime.UtcNow;
- ApprovedByAdminID = adminID;
- UpdatedAt = DateTime.UtcNow;
- }
- public void Reject(string adminID, string? reason)
- {
- ApprovalStatus = DeveloperApprovalStatus.Rejected;
- ApprovalReason = reason;
- ApprovedAt = DateTime.UtcNow;
- ApprovedByAdminID = adminID;
- UpdatedAt = DateTime.UtcNow;
- }
- public void Suspend(string adminID, string? reason)
- {
- ApprovalStatus = DeveloperApprovalStatus.Suspended;
- ApprovalReason = reason;
- ApprovedByAdminID = adminID;
- UpdatedAt = DateTime.UtcNow;
- }
- }
|