using Butter.Dtos.User;
using Lactose.Models;

namespace Lactose.Mapper;

/// <summary>
/// Provides mapping methods for User objects.
/// </summary>
public static class UsersMapper {
    /// <summary>
    /// Maps a User object to a UserInfoDto object.
    /// </summary>
    /// <param name="user">The User object to map.</param>
    /// <returns>A UserInfoDto object containing the mapped data.</returns>
    public static UserInfoDto ToGetUsersDto(this User user) {
        return new UserInfoDto {
            Id        = user.Id,
            Email     = user.Email,
            Username  = user.Username,
            CreatedAt = user.CreatedAt,
            IsBanned  = user.BannedAt != null,
            DeletedAt = user.DeletedAt,
            AccessLevel = user.AccessLevel,
        };
    }
}
