using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace IWS5.DatabaseAccess.IwsDataModels;

[Table("ATDocumentCabinet")]
[Index("CabinetId", Name = "ATDocumentCabinet_IX_CabinetID")]
[Index("CabinetName", Name = "UK_ATDocumentCabinet_CabinetName", IsUnique = true)]
[Index("ObjectId", Name = "UK_ATDocumentCabinet_ObjectId", IsUnique = true)]
public partial class AtdocumentCabinet
{
    [Key]
    [Column("CabinetID")]
    public int CabinetId { get; set; }

    [StringLength(255)]
    public string CabinetName { get; set; } = null!;

    [StringLength(255)]
    public string? CabinetDescription { get; set; }

    public int TemplateTypeId { get; set; }

    public int? DbConnectionId { get; set; }

    [StringLength(50)]
    public string? DbName { get; set; }

    public Guid ObjectId { get; set; }

    [Column(TypeName = "datetime")]
    public DateTime CreateDate { get; set; }

    [Column(TypeName = "datetime")]
    public DateTime ModifyDate { get; set; }

    [InverseProperty("Cabinet")]
    public virtual ICollection<AtdocumentCabinetDef> AtdocumentCabinetDefs { get; set; } = new List<AtdocumentCabinetDef>();

    [InverseProperty("Cabinet")]
    public virtual ICollection<Atdocument> Atdocuments { get; set; } = new List<Atdocument>();

    [InverseProperty("DefaultDocTemplateNavigation")]
    public virtual ICollection<AtprocessDefinition> AtprocessDefinitions { get; set; } = new List<AtprocessDefinition>();

    [InverseProperty("DocumentTemplateObject")]
    public virtual ICollection<AtprocessDocumentTemplateRight> AtprocessDocumentTemplateRights { get; set; } = new List<AtprocessDocumentTemplateRight>();

    [InverseProperty("DocumentCabinet")]
    public virtual ICollection<Attemplate> Attemplates { get; set; } = new List<Attemplate>();

    [ForeignKey("DbConnectionId")]
    [InverseProperty("AtdocumentCabinets")]
    public virtual Atconnection? DbConnection { get; set; }

    [ForeignKey("TemplateTypeId")]
    [InverseProperty("AtdocumentCabinets")]
    public virtual AttemplateType TemplateType { get; set; } = null!;
}
