EmailProcessorConfiguration.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.Json.Serialization;
  6. using System.Threading.Tasks;
  7. namespace qdr.app.studiou.orders2printpack.EmailStorage
  8. {
  9. /// <summary>
  10. /// Configuration class for the EmailStorageProcessor containing all necessary
  11. /// settings for TSS (Temporary Shared Storage) API and SMTP server connectivity.
  12. /// This class is designed to be serialized/deserialized from JSON configuration files.
  13. /// </summary>
  14. public class EmailProcessorConfiguration
  15. {
  16. #region TSS API Configuration
  17. /// <summary>
  18. /// API key for accessing the Temporary Shared Storage (TSS) service.
  19. /// This key is required for file upload operations to the shared storage.
  20. /// </summary>
  21. [JsonPropertyName("tss-api-key")]
  22. [JsonRequired]
  23. public string TssAPIKey { get; set; } = string.Empty;
  24. /// <summary>
  25. /// Base URL for the Temporary Shared Storage (TSS) API endpoint.
  26. /// Should include the protocol (https://) and domain.
  27. /// </summary>
  28. [JsonPropertyName("tss-url")]
  29. [JsonRequired]
  30. public string TssUrl { get; set; } = string.Empty;
  31. #endregion
  32. #region SMTP Server Configuration
  33. /// <summary>
  34. /// SMTP server hostname or IP address for sending emails.
  35. /// Examples: smtp.gmail.com, mail.company.com, 192.168.1.100
  36. /// </summary>
  37. [JsonPropertyName("smtp-server")]
  38. [JsonRequired]
  39. public string SmtpServer { get; set; } = string.Empty;
  40. /// <summary>
  41. /// SMTP server port number for email communication.
  42. /// Common ports: 25 (plain), 587 (STARTTLS), 465 (SSL/TLS)
  43. /// Defaults to 587 which is the standard submission port with STARTTLS.
  44. /// </summary>
  45. [JsonPropertyName("smtp-server-port")]
  46. [JsonRequired]
  47. public int SmtpServerPort { get; set; } = 587; // Default SMTP submission port
  48. /// <summary>
  49. /// Username for SMTP server authentication.
  50. /// This is typically an email address or account name depending on the server.
  51. /// </summary>
  52. [JsonPropertyName("smtp-server-user")]
  53. [JsonRequired]
  54. public string SmtpServerUser { get; set; } = string.Empty;
  55. /// <summary>
  56. /// Password for SMTP server authentication.
  57. /// For security, consider using app-specific passwords when available.
  58. /// This value should be kept secure and not logged.
  59. /// </summary>
  60. [JsonPropertyName("smtp-server-pwd")]
  61. [JsonRequired]
  62. public string SmtpServerPassword { get; set; } = string.Empty;
  63. /// <summary>
  64. /// Indicates whether to enable SSL/TLS encryption for SMTP communication.
  65. /// Defaults to true for security. Most modern SMTP servers require encryption.
  66. /// </summary>
  67. [JsonPropertyName("smtp-enable-ssl")]
  68. public bool SmtpEnableSsl { get; set; } = true; // Default to secure connection
  69. #endregion
  70. }
  71. }