using Meezi.Core.Enums;

namespace Meezi.Core.Entities;

public class Employee : TenantEntity
{
    public string? BranchId { get; set; }
    public string Name { get; set; } = string.Empty;
    public string Phone { get; set; } = string.Empty;
    public string? NationalId { get; set; }
    public EmployeeRole Role { get; set; }
    public decimal BaseSalary { get; set; }
    public string? PinCode { get; set; }

    /// <summary>Optional username for password-based dashboard/POS login (set by cafe admin).</summary>
    public string? Username { get; set; }

    /// <summary>PBKDF2/SHA-256 hash. Null means password login is not enabled for this employee.</summary>
    public string? PasswordHash { get; set; }

    public Cafe Cafe { get; set; } = null!;
    public Branch? Branch { get; set; }
    public ICollection<Order> Orders { get; set; } = [];
    public ICollection<EmployeeSalary> Salaries { get; set; } = [];
    public ICollection<Attendance> Attendances { get; set; } = [];
    public ICollection<EmployeeSchedule> Schedules { get; set; } = [];
    public ICollection<LeaveRequest> LeaveRequests { get; set; } = [];

    /// <summary>Per-branch role assignments (multi-branch staff). Owners are café-wide and may have none.</summary>
    public ICollection<EmployeeBranchRole> BranchRoles { get; set; } = [];
}
