//
// ▄▄▄▄ ▄▄▄▄ ▄▄▄▄
// ▄▄▄▄▄▄█ █▄▄▄▄▄█ █▄▄▄▄▄█ █
// █__ --█ █__ --█ ◄█ - █
// █▄▄▄▄▄█▄▄█▄▄▄▄▄█▄▄█▄▄█▄▄▄▄▄█
// ┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ━━━━ ━ ━┉ ┉ ┉
// │ Copyright (c) JP Dillingham.
// │
// │ 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, version 3.
// │
// │ 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 AGPLv3. See the LICENSE file in the root directory of this
// │ project for the complete terms and conditions.
// │
// │ https://slskd.org
// │
// ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ╌ ╌╌╌╌ ╌
// │ SPDX-FileCopyrightText: JP Dillingham
// │ SPDX-License-Identifier: AGPL-3.0-only
// ╰───────────────────────────────────────────╶──── ─ ─── ─ ── ──┈ ┈
//
namespace slskd.Files
{
using System;
using System.Collections.Generic;
using System.IO;
///
/// A file directory on the host filesystem.
///
public record FilesystemDirectory
{
///
/// The name of the directory.
///
public string Name { get; init; }
///
/// The fully qualified name of the directory.
///
public string FullName { get; init; }
///
/// The directories' attributes.
///
public FileAttributes Attributes { get; init; }
///
/// The timestamp at which the directory was created.
///
public DateTime CreatedAt { get; init; }
///
/// The timestamp at which the directory was last modified.
///
public DateTime ModifiedAt { get; init; }
///
/// The files within the directory.
///
public IEnumerable Files { get; init; }
///
/// The directories within the directory.
///
public IEnumerable Directories { get; init; }
///
/// Maps a from the specified .
///
/// The DirectoryInfo instance from which to map.
/// A new instance of FilesystemDirectory.
public static FilesystemDirectory FromDirectoryInfo(DirectoryInfo i)
{
return new FilesystemDirectory
{
Name = i.Name,
FullName = i.FullName,
Attributes = i.Attributes,
CreatedAt = i.CreationTimeUtc,
ModifiedAt = i.LastWriteTimeUtc,
};
}
}
}