namespace Meezi.Core.Entities;

/// <summary>Physical branch (شعبه) under a café tenant.</summary>
public class Branch : TenantEntity
{
    public string Name { get; set; } = string.Empty;
    public string? Address { get; set; }
    public string? City { get; set; }
    public string? Phone { get; set; }
    public bool IsActive { get; set; } = true;
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;

    /// <summary>When set with <see cref="BaseEntity.DeletedAt"/>, branch can be restored until this UTC time.</summary>
    public DateTime? ScheduledPermanentDeleteAt { get; set; }

    // Thermal printer (TCP ESC/POS)
    public string? ReceiptPrinterIp { get; set; }
    public int? ReceiptPrinterPort { get; set; }
    public string? KitchenPrinterIp { get; set; }
    public int? KitchenPrinterPort { get; set; }
    public int PaperWidthMm { get; set; } = 80;
    public bool AutoCutEnabled { get; set; } = true;
    public string? ReceiptHeader { get; set; }
    public string? ReceiptFooter { get; set; }
    public string? WifiPassword { get; set; }
    /// <summary>Branch-specific logo on QR guest menu (falls back to café logo).</summary>
    public string? LogoUrl { get; set; }
    public string? WelcomeText { get; set; }
    public string? AccentColor { get; set; }
    /// <summary>Branch tax % when café <see cref="Cafe.AllowBranchTaxOverride"/> is true.</summary>
    public decimal? TaxRate { get; set; }

    // Card POS terminal (HTTP bridge on local network)
    public string? PosDeviceIp { get; set; }
    public int? PosDevicePort { get; set; }

    public Cafe Cafe { get; set; } = null!;
    public ICollection<TableSection> Sections { get; set; } = [];
    public ICollection<Table> Tables { get; set; } = [];
    public ICollection<Order> Orders { get; set; } = [];
    public ICollection<Employee> Staff { get; set; } = [];
}
