//-----------------------------------------------------------------------
//
// Copyright (c) aliasvault. All rights reserved.
// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
//
//-----------------------------------------------------------------------
namespace AliasClientDb;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using AliasClientDb.Abstracts;
///
/// Item entity (renamed from Credential).
/// Represents a vault item that can be of various types (Login, CreditCard, Identity, etc.).
///
public class Item : SyncableEntity
{
///
/// Gets or sets the item ID.
///
[Key]
public Guid Id { get; set; }
///
/// Gets or sets the item name.
///
[StringLength(255)]
public string? Name { get; set; }
///
/// Gets or sets the item type (Login, CreditCard, Identity, SecureNote, ApiKey, Passkey).
///
[Required]
[StringLength(50)]
public string ItemType { get; set; } = "Login";
///
/// Gets or sets the logo ID foreign key.
///
public Guid? LogoId { get; set; }
///
/// Gets or sets the logo object.
///
[ForeignKey("LogoId")]
public virtual Logo? Logo { get; set; }
///
/// Gets or sets the timestamp when this item was moved to the "Recently Deleted" folder.
/// When null, the item is active. When set, the item is in the trash and can be restored.
/// After a configurable retention period (default 30 days), items with DeletedAt set
/// are permanently deleted (converted to tombstones with IsDeleted = true).
///
public DateTime? DeletedAt { get; set; }
///
/// Gets or sets the folder ID foreign key.
///
public Guid? FolderId { get; set; }
///
/// Gets or sets the folder object.
///
[ForeignKey("FolderId")]
public virtual Folder? Folder { get; set; }
///
/// Gets or sets the field value objects.
///
public virtual ICollection FieldValues { get; set; } = [];
///
/// Gets or sets the attachment objects.
///
public virtual ICollection Attachments { get; set; } = [];
///
/// Gets or sets the TOTP code objects.
///
public virtual ICollection TotpCodes { get; set; } = [];
///
/// Gets or sets the passkey objects.
///
public virtual ICollection Passkeys { get; set; } = [];
///
/// Gets or sets the item-tag relationships.
///
public virtual ICollection ItemTags { get; set; } = [];
}