namespace Hua.Todo.Application.CloudSync.Auth;

/// <summary>
/// 默认的角色-权限映射（内置最小集合）。
/// </summary>
public class DefaultRolePermissionMapper : IRolePermissionMapper
{
    /// <inheritdoc />
    public IReadOnlyList<string> GetPermissions(string role)
    {
        return role switch
        {
            "admin" => new[]
            {
                CloudPermissions.TasksRead,
                CloudPermissions.TasksWrite,
                CloudPermissions.SyncWrite,
                CloudPermissions.PolicyRead,
                CloudPermissions.PolicyWrite,
                CloudPermissions.UsersManage
            },
            "readonly" => new[]
            {
                CloudPermissions.TasksRead,
                CloudPermissions.PolicyRead
            },
            "nosync" => new[]
            {
                CloudPermissions.TasksRead,
                CloudPermissions.TasksWrite,
                CloudPermissions.PolicyRead
            },
            _ => new[]
            {
                CloudPermissions.TasksRead,
                CloudPermissions.TasksWrite,
                CloudPermissions.SyncWrite,
                CloudPermissions.PolicyRead
            }
        };
    }
}

