Config.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. namespace Domain.Entities.Common
  2. {
  3. public sealed class Config
  4. {
  5. public int ID { get; private set; }
  6. public DateTime LastUpdatedAt { get; private set; } = DateTime.UtcNow;
  7. public byte[] RowVersion { get; private set; } = [];
  8. public BasicConfig Basic { get; private set; } = new();
  9. public ImagesConfig Images { get; private set; } = new();
  10. public MetaConfig Meta { get; private set; } = new();
  11. public CompanyConfig Company { get; private set; } = new();
  12. public AccountConfig Account { get; private set; } = new();
  13. public EmailTemplateConfig EmailTemplate { get; private set; } = new();
  14. public ExternalApiConfig External { get; private set; } = new();
  15. public PaymentConfig Payment { get; private set; } = new();
  16. public CryptoConfig Crypto { get; private set; } = new();
  17. private Config() { }
  18. public static Config Create()
  19. {
  20. return new();
  21. }
  22. public void Update(
  23. BasicConfig basic,
  24. ImagesConfig images,
  25. MetaConfig meta,
  26. CompanyConfig company,
  27. AccountConfig account,
  28. EmailTemplateConfig emailTemplate,
  29. ExternalApiConfig external,
  30. PaymentConfig payment,
  31. CryptoConfig crypto
  32. ) {
  33. Basic = basic ?? throw new ArgumentNullException(nameof(basic));
  34. Images = images ?? throw new ArgumentNullException(nameof(images));
  35. Meta = meta ?? throw new ArgumentNullException(nameof(meta));
  36. Company = company ?? throw new ArgumentNullException(nameof(company));
  37. Account = account ?? throw new ArgumentNullException(nameof(account));
  38. EmailTemplate = emailTemplate ?? throw new ArgumentNullException(nameof(emailTemplate));
  39. External = external ?? throw new ArgumentNullException(nameof(external));
  40. Payment = payment ?? throw new ArgumentNullException(nameof(payment));
  41. Crypto = crypto ?? throw new ArgumentNullException(nameof(crypto));
  42. LastUpdatedAt = DateTime.UtcNow;
  43. }
  44. }
  45. #region Owned Groups
  46. // ==================================================
  47. // 기본 정보 (Basic)
  48. // ==================================================
  49. public sealed class BasicConfig
  50. {
  51. public string? SiteName { get; set; }
  52. public string? SiteURL { get; set; }
  53. public string? RootID { get; set; }
  54. public string? FromEmail { get; set; }
  55. public string? FromName { get; set; }
  56. public string? SmtpServer { get; set; }
  57. public int? SmtpPort { get; set; }
  58. public bool SmtpEnableSSL { get; set; }
  59. public string? SmtpUsername { get; set; }
  60. public string? SmtpPassword { get; set; }
  61. public string? AdminWhiteIPList { get; set; }
  62. public string? FrontWhiteIPList { get; set; }
  63. public string? BlockAlertTitle { get; set; }
  64. public string? BlockAlertContent { get; set; }
  65. public bool IsMaintenance { get; set; } = false;
  66. public string? MaintenanceContent { get; set; }
  67. }
  68. // ==================================================
  69. // 기본 이미지 (Images)
  70. // ==================================================
  71. public sealed class ImagesConfig
  72. {
  73. public string? Favicon { get; set; }
  74. public string? LogoSquare { get; set; }
  75. public string? LogoHorizontal { get; set; }
  76. public string? OgDefault { get; set; }
  77. public string? TwitterImage { get; set; }
  78. public string? AppleTouchIcon { get; set; }
  79. public string? AppIcon_192 { get; set; }
  80. public string? AppIcon_512 { get; set; }
  81. }
  82. // ==================================================
  83. // 메타 태그 (Meta)
  84. // ==================================================
  85. public sealed class MetaConfig
  86. {
  87. public string? Keywords { get; set; }
  88. public string? Description { get; set; }
  89. public string? Author { get; set; }
  90. public string? Viewport { get; set; }
  91. public string? ApplicationName { get; set; }
  92. public string? Generator { get; set; }
  93. public string? Robots { get; set; }
  94. public string? Adds { get; set; }
  95. }
  96. // ==================================================
  97. // 회사 정보 (Company)
  98. // ==================================================
  99. public sealed class CompanyConfig
  100. {
  101. public string? Name { get; set; }
  102. public string? RegNo { get; set; }
  103. public string? Address { get; set; }
  104. public string? ZipCode { get; set; }
  105. public string? Owner { get; set; }
  106. public string? Tel { get; set; }
  107. public string? Fax { get; set; }
  108. public string? RetailSaleNo { get; set; }
  109. public string? AddedSaleNo { get; set; }
  110. public string? Hosting { get; set; }
  111. public string? AdminName { get; set; }
  112. public string? AdminEmail { get; set; }
  113. public string? SiteUrl { get; set; }
  114. public string? BankCode { get; set; }
  115. public string? BankOwner { get; set; }
  116. public string? BankNumber { get; set; }
  117. }
  118. // ==================================================
  119. // 회원가입 설정 (Account)
  120. // ==================================================
  121. public sealed class AccountConfig
  122. {
  123. // 회원 가입 시
  124. public bool IsRegisterBlock { get; set; } = false;
  125. public bool IsRegisterEmailAuth { get; set; } = false;
  126. public ushort? PasswordMinLength { get; set; }
  127. public ushort? PasswordUppercaseLength { get; set; }
  128. public ushort? PasswordNumbersLength { get; set; }
  129. public ushort? PasswordSpecialcharsLength { get; set; }
  130. public string? DeniedEmailList { get; set; }
  131. public string? DeniedNameList { get; set; }
  132. // 회원 수정 시
  133. public ushort? ChangeEmailDay { get; set; }
  134. public ushort? ChangeNameDay { get; set; }
  135. public ushort? ChangeSummaryDay { get; set; }
  136. public ushort? ChangeIntroDay { get; set; }
  137. public ushort? ChangePasswordDay { get; set; }
  138. // 로그인 시
  139. public ushort? MaxLoginTryCount { get; set; }
  140. public ushort? MaxLoginTryLimitSecond { get; set; }
  141. }
  142. // ==================================================
  143. // 알림 발송 양식 - 이메일 (EmailTemplate)
  144. // ==================================================
  145. public sealed class EmailTemplateConfig
  146. {
  147. public string? RegisterEmailFormTitle { get; set; }
  148. public string? RegisterEmailFormContent { get; set; }
  149. public string? RegistrationEmailFormTitle { get; set; }
  150. public string? RegistrationEmailFormContent { get; set; }
  151. public string? ResetPasswordEmailFormTitle { get; set; }
  152. public string? ResetPasswordEmailFormContent { get; set; }
  153. public string? ChangedPasswordEmailFormTitle { get; set; }
  154. public string? ChangedPasswordEmailFormContent { get; set; }
  155. public string? WithdrawEmailFormTitle { get; set; }
  156. public string? WithdrawEmailFormContent { get; set; }
  157. public string? EmailVerifyFormTitle { get; set; }
  158. public string? EmailVerifyFormContent { get; set; }
  159. public string? ChangedEmailFormTitle { get; set; }
  160. public string? ChangedEmailFormContent { get; set; }
  161. }
  162. // ==================================================
  163. // 외부 API 설정 (External)
  164. // ==================================================
  165. public sealed class ExternalApiConfig
  166. {
  167. /** YouTube **/
  168. public string? YouTubeApiKeyEnc { get; set; }
  169. public string? YouTubeApiName { get; set; }
  170. /** 구글 **/
  171. public string? GoogleClientId { get; set; }
  172. public string? GoogleClientSecretEnc { get; set; }
  173. public string? GoogleAppId { get; set; }
  174. /** 다날 페이 **/
  175. //[Comment("Danal 결제 환경")]
  176. //public string? DanalPayMode { get; set; }
  177. //[Comment("Danal Test CPID")]
  178. //public string? DanalTestCpid { get; set; }
  179. //[Comment("Danal Test Client Key (암호화 저장 권장)")]
  180. //public string? DanalTestClientKeyEnc { get; set; }
  181. //[Comment("Danal Test Secret Key (암호화 저장 권장)")]
  182. //public string? DanalTestSecretKeyEnc { get; set; }
  183. //[Comment("Danal Live CPID")]
  184. //public string? DanalLiveCpid { get; set; }
  185. //[Comment("Danal Live Client Key (암호화 저장 권장)")]
  186. //public string? DanalLiveClientKeyEnc { get; set; }
  187. //[Comment("Danal Live Secret Key (암호화 저장 권장)")]
  188. //public string? DanalLiveSecretKeyEnc { get; set; }
  189. }
  190. // ==================================================
  191. // 결제 설정 (Payment)
  192. // ==================================================
  193. public sealed class PaymentConfig
  194. {
  195. /** 다날 페이 **/
  196. //[Range(0, 100)]
  197. //[Comment("다날 신용카드 수수료(%)")]
  198. //public decimal? DanalCardFeeRate { get; set; }
  199. //[Range(0, 999_999_999)]
  200. //[Comment("다날 신용카드 수수료(원)")]
  201. //public decimal? DanalCardFeeAmount { get; set; }
  202. //[Range(0, 100)]
  203. //[Comment("다날 계좌이체 수수료(%)")]
  204. //public decimal? DanalTransferFeeRate { get; set; }
  205. //[Range(0, 999_999_999)]
  206. //[Comment("다날 계좌이체 수수료(원)")]
  207. //public decimal? DanalTransferFeeAmount { get; set; }
  208. //[Range(0, 100)]
  209. //[Comment("다날 가상계좌 수수료(%)")]
  210. //public decimal? DanalVbankFeeRate { get; set; }
  211. //[Range(0, 999_999_999)]
  212. //[Comment("다날 가상계좌 수수료(원)")]
  213. //public decimal? DanalVbankFeeAmount { get; set; }
  214. //[Range(0, 100)]
  215. //[Comment("다날 간편결제 수수료(%)")]
  216. //public decimal? DanalSimpleFeeRate { get; set; }
  217. //[Range(0, 999_999_999)]
  218. //[Comment("다날 간편결제 수수료(원)")]
  219. //public decimal? DanalSimpleFeeAmount { get; set; }
  220. }
  221. // ==================================================
  222. // 코인/시세 설정 (Crypto)
  223. // ==================================================
  224. public sealed class CryptoConfig
  225. {
  226. public int TickerRefreshSeconds { get; set; } = 5;
  227. public decimal SurgeThreshold { get; set; } = 5.0m;
  228. public decimal PlungeThreshold { get; set; } = -5.0m;
  229. public int MainPageCoinCount { get; set; } = 10;
  230. }
  231. #endregion
  232. }