using System.ComponentModel.DataAnnotations;

namespace TakeoutSaaS.Module.Messaging.Options;

/// <summary>
/// RabbitMQ 连接与交换机配置。
/// </summary>
public sealed class RabbitMqOptions
{
    /// <summary>
    /// 主机名。
    /// </summary>
    [Required]
    public string Host { get; set; } = "localhost";

    /// <summary>
    /// 端口。
    /// </summary>
    [Range(1, 65535)]
    public int Port { get; set; } = 5672;

    /// <summary>
    /// 用户名。
    /// </summary>
    [Required]
    public string Username { get; set; } = "guest";

    /// <summary>
    /// 密码。
    /// </summary>
    [Required]
    public string Password { get; set; } = "guest";

    /// <summary>
    /// 虚拟主机。
    /// </summary>
    public string VirtualHost { get; set; } = "/";

    /// <summary>
    /// 默认交换机名称。
    /// </summary>
    [Required]
    public string Exchange { get; set; } = "takeout.events";

    /// <summary>
    /// 交换机类型，默认 topic。
    /// </summary>
    public string ExchangeType { get; set; } = "topic";

    /// <summary>
    /// 消费预取数量。
    /// </summary>
    [Range(1, 1000)]
    public ushort PrefetchCount { get; set; } = 20;
}
