Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

1.6 KB
Raw Blame
//-----------------------------------------------------------------------
// <copyright file="Attachment.cs" company="aliasvault">
// Copyright (c) aliasvault. All rights reserved.
// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
// </copyright>
//-----------------------------------------------------------------------

namespace AliasClientDb;

using System.ComponentModel.DataAnnotations;
using AliasClientDb.Abstracts;

/// <summary>
/// Attachment entity.
/// </summary>
public class Attachment : ManifestScopedEntity
{
    /// <summary>
    /// Gets or sets the attachment primary key.
    /// </summary>
    public Guid Id { get; set; }

    /// <summary>
    /// Gets or sets the filename value.
    /// </summary>
    [StringLength(255)]
    public string Filename { get; set; } = string.Empty;

    /// <summary>
    /// Gets or sets the file bytes; null once the attachment is deleted, or while they are not loaded (see <see cref="BlobHash"/>).
    /// </summary>
    public byte[]? Blob { get; set; }

    /// <summary>
    /// Gets or sets the hash of the blob holding the file bytes. Local only: set while <see cref="Blob"/> is null, which means the bytes are not loaded by this client yet (lazy-loading).
    /// </summary>
    [StringLength(64)]
    public string? BlobHash { get; set; }

    /// <summary>
    /// Gets or sets the item foreign key.
    /// </summary>
    public Guid ItemId { get; set; }

    /// <summary>
    /// Gets or sets the item navigation property.
    /// </summary>
    public virtual Item Item { get; set; } = null!;
}