//
// ▄▄▄▄ ▄▄▄▄ ▄▄▄▄
// ▄▄▄▄▄▄█ █▄▄▄▄▄█ █▄▄▄▄▄█ █
// █__ --█ █__ --█ ◄█ - █
// █▄▄▄▄▄█▄▄█▄▄▄▄▄█▄▄█▄▄█▄▄▄▄▄█
// ┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ━━━━ ━ ━┉ ┉ ┉
// │ Copyright (c) JP Dillingham.
// │
// │ https://slskd.org
// │
// │ This program is free software: you can redistribute it and/or modify
// │ it under the terms of the GNU Affero General Public License as published
// │ by the Free Software Foundation, either version 3 of the License, or
// │ (at your option) any later version.
// │
// │ This program is distributed in the hope that it will be useful,
// │ but WITHOUT ANY WARRANTY; without even the implied warranty of
// │ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// │ GNU Affero General Public License for more details.
// │
// │ You should have received a copy of the GNU Affero General Public License
// │ along with this program. If not, see https://www.gnu.org/licenses/.
// │
// │ This program is distributed with Additional Terms pursuant to
// │ Section 7 of the GNU Affero General Public License. See the
// │ LICENSE file in the root directory of this project for the
// │ complete terms and conditions.
// │
// ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ╌ ╌╌╌╌ ╌
// │ SPDX-FileCopyrightText: JP Dillingham
// │ SPDX-License-Identifier: AGPL-3.0-only
// ╰───────────────────────────────────────────╶──── ─ ─── ─ ── ──┈ ┈
//
namespace slskd.Users.API
{
using Soulseek;
public class UserDataResponse
{
///
/// The average upload speed of the user.
///
public int AverageSpeed { get; set; }
///
/// The user's country code, if provided.
///
public string CountryCode { get; set; }
///
/// The number of directories shared by the user.
///
public int DirectoryCount { get; set; }
///
/// The number of files shared by the user.
///
public int FileCount { get; set; }
///
/// A value indicating whether this user data belongs to the currently logged in user.
///
public bool? Self { get; set; }
///
/// The number of the user's free download slots, if provided.
///
public int? SlotsFree { get; set; }
///
/// The status of the user (0 = offline, 1 = away, 2 = online).
///
public UserPresence Status { get; set; }
///
/// The number of uploads tracked by the server for the user.
///
public long UploadCount { get; set; }
///
/// The username of the user.
///
public string Username { get; set; }
public static UserDataResponse FromUserData(UserData userData, bool self = false)
{
return new UserDataResponse()
{
AverageSpeed = userData.AverageSpeed,
CountryCode = userData.CountryCode,
DirectoryCount = userData.DirectoryCount,
UploadCount = userData.UploadCount,
FileCount = userData.FileCount,
SlotsFree = userData.SlotsFree,
Status = userData.Status,
Username = userData.Username,
Self = self ? self : (bool?)null,
};
}
}
}