using Baya.Application.Common;
using Baya.Domain.Entities.Messaging;
using Baya.Domain.Entities.User;

namespace Baya.Application.Features.Messaging;

/// <summary>Derives the display <c>role_on_ticket</c> label from a user's platform roles (staff → admin, nurse
/// → nurse, else customer). Purely a label — never an authorization source.</summary>
public static class TicketRoleResolver
{
    public static string Derive(IReadOnlyList<string> roles)
    {
        if (StaffRoles.IsStaff(roles))
            return TicketParticipantRole.Admin;
        if (roles.Contains(RoleNames.Nurse))
            return TicketParticipantRole.Nurse;
        return TicketParticipantRole.Customer;
    }
}
