using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace LibreMetaverse.RLV
{
public interface IRlvQueryCallbacks
{
///
/// Checks if an object exists in the world
///
/// Object ID to check
/// Cancellation token
/// True if the object exists
Task ObjectExistsAsync(Guid objectId, CancellationToken cancellationToken);
///
/// Checks if the user is currently sitting
///
/// Cancellation token
/// True if sitting
Task IsSittingAsync(CancellationToken cancellationToken);
///
/// Gets environment info for a setting
///
/// Setting name
/// Cancellation token
/// Success flag and environment info if successful
Task<(bool Success, string EnvironmentSettingValue)> TryGetEnvironmentSettingValueAsync(string settingName, CancellationToken cancellationToken);
///
/// Gets debug info for a setting
///
/// Setting name
/// Cancellation token
/// Success flag and debug info if successful
Task<(bool Success, string DebugSettingValue)> TryGetDebugSettingValueAsync(string settingName, CancellationToken cancellationToken);
///
/// Gets the ID of the object the user is sitting on
///
/// Cancellation token
/// Success flag and sit ID if successful
Task<(bool Success, Guid SitId)> TryGetSitIdAsync(CancellationToken cancellationToken);
///
/// Gets the RLV shared folder
///
/// Cancellation token
/// Success flag and shared folder successful
Task<(bool Success, RlvSharedFolder? SharedFolder)> TryGetSharedFolderAsync(CancellationToken cancellationToken);
///
/// Gets current camera settings
///
/// Cancellation token
/// Success flag and camera settings if successful
Task<(bool Success, CameraSettings? CameraSettings)> TryGetCameraSettingsAsync(CancellationToken cancellationToken);
///
/// Gets the current user's active group name
///
/// Cancellation token
/// Success flag and active group name if successful
Task<(bool Success, string ActiveGroupName)> TryGetActiveGroupNameAsync(CancellationToken cancellationToken);
///
/// Gets the current user's outfit. This will be all worn and attached items and may include
/// items outside of the shared #RLV folder
///
/// Cancellation token
/// Success flag and current outfit if successful
Task<(bool Success, IReadOnlyList? CurrentOutfit)> TryGetCurrentOutfitAsync(CancellationToken cancellationToken);
}
///
/// Represents a request to attach an item to the avatar
///
public class AttachmentRequest
{
public Guid ItemId { get; }
public RlvAttachmentPoint AttachmentPoint { get; }
public bool ReplaceExistingAttachments { get; }
public AttachmentRequest(Guid itemId, RlvAttachmentPoint attachmentPoint, bool replaceExistingAttachments)
{
ItemId = itemId;
AttachmentPoint = attachmentPoint;
ReplaceExistingAttachments = replaceExistingAttachments;
}
public override bool Equals(object obj)
{
return obj is AttachmentRequest request &&
ItemId.Equals(request.ItemId) &&
AttachmentPoint == request.AttachmentPoint &&
ReplaceExistingAttachments == request.ReplaceExistingAttachments;
}
public override int GetHashCode()
{
return HashCode.Combine(ItemId, AttachmentPoint, ReplaceExistingAttachments);
}
}
}