// Copyright (C) 2025, The Duplicati Team
// https://duplicati.com, hello@duplicati.com
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
namespace Duplicati.Library.Main.Database
{
///
/// Represents a remote volume entry with its ID, name, hash, size, type, state,
/// delete grace period, and archive time.
/// Implements the IRemoteVolume interface.
///
public struct RemoteVolumeEntry : IRemoteVolume
{
///
/// The ID of the remote volume entry.
///
public long ID { get; private set; }
public string Name { get; private set; }
public string Hash { get; private set; }
public long Size { get; private set; }
///
/// The type of the remote volume, indicating whether it is a file or a directory.
///
public RemoteVolumeType Type { get; private set; }
///
/// The state of the remote volume, indicating its current status.
///
public RemoteVolumeState State { get; private set; }
///
/// The time period during which the remote volume can be deleted without permanent loss.
///
public DateTime DeleteGracePeriod { get; private set; }
///
/// The time when the remote volume was archived, indicating when it was moved to a less accessible state.
///
public DateTime ArchiveTime { get; private set; }
///
/// Represents an empty remote volume entry with default values.
/// This is useful for initializing or resetting remote volume entries.
///
public static readonly RemoteVolumeEntry Empty = new RemoteVolumeEntry(-1, null, null, -1, (RemoteVolumeType)(-1), (RemoteVolumeState)(-1), default(DateTime), default(DateTime));
///
/// Initializes a new instance of the RemoteVolumeEntry struct with specified values.
///
/// The ID of the remote volume entry.
/// The name of the remote volume entry.
/// The hash of the remote volume entry.
/// The size of the remote volume entry.
/// The type of the remote volume entry (file or directory).
/// The state of the remote volume entry.
/// The delete grace period for the remote volume entry.
/// The archive time for the remote volume entry.
public RemoteVolumeEntry(long id, string name, string hash, long size, RemoteVolumeType type, RemoteVolumeState state, DateTime deleteGracePeriod, DateTime archiveTime)
{
ID = id;
Name = name;
Size = size;
Type = type;
State = state;
Hash = hash;
DeleteGracePeriod = deleteGracePeriod;
ArchiveTime = archiveTime;
}
}
}