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

namespace IWS5.DatabaseAccess.IwsDataModels;

[Table("ATProcessDefinition")]
[Index("Creator", Name = "ATProcessDefinition_IX_Creator")]
[Index("ProcessGroupId", Name = "ATProcessDefinition_IX_GroupId")]
[Index("ObjectId", Name = "ATProcessDefinition_IX_ObjectId")]
[Index("Status", Name = "ATProcessDefinition_IX_Status")]
[Index("ProcessType", Name = "ATProcessDefinition_IX_Type")]
[Index("ProcessName", "ProcessVersion", Name = "IX_ATProcessDefinition", IsUnique = true)]
[Index("ObjectId", Name = "UK_ATProcessDefinition_ObjectId", IsUnique = true)]
public partial class AtprocessDefinition
{
    [Key]
    [Column("ProcessID")]
    public int ProcessId { get; set; }

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

    public int ProcessVersion { get; set; }

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

    public int? Versioning { get; set; }

    public int Status { get; set; }

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

    public int ProcessType { get; set; }

    public int? ExpirationInterval { get; set; }

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

    [StringLength(32)]
    public string? StopQueue { get; set; }

    [Column("ProcessGroupID")]
    public int? ProcessGroupId { get; set; }

    [Column("StartEventID")]
    public int? StartEventId { get; set; }

    [Column(TypeName = "image")]
    public byte[]? Script { get; set; }

    public int? Synchronous { get; set; }

    public int? ScriptLanguage { get; set; }

    [Column(TypeName = "image")]
    public byte[]? ExScript { get; set; }

    [StringLength(1024)]
    public string? WindowStyle { get; set; }

    public Guid ObjectId { get; set; }

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

    [Column(TypeName = "image")]
    public byte[]? Map { get; set; }

    public int DefaultDocTemplate { get; set; }

    [InverseProperty("Process")]
    public virtual ICollection<AteventDefinition> AteventDefinitions { get; set; } = new List<AteventDefinition>();

    [InverseProperty("Process")]
    public virtual ICollection<AteventTriggerDefinition> AteventTriggerDefinitions { get; set; } = new List<AteventTriggerDefinition>();

    [InverseProperty("Process")]
    public virtual ICollection<AtfieldDefinition> AtfieldDefinitions { get; set; } = new List<AtfieldDefinition>();

    [InverseProperty("Process")]
    public virtual ICollection<Atform> Atforms { get; set; } = new List<Atform>();

    [InverseProperty("Process")]
    public virtual ICollection<Atlink> Atlinks { get; set; } = new List<Atlink>();

    [InverseProperty("Process")]
    public virtual ICollection<Atmail> Atmails { get; set; } = new List<Atmail>();

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

    [InverseProperty("Process")]
    public virtual ICollection<AtprocessImportRule> AtprocessImportRules { get; set; } = new List<AtprocessImportRule>();

    [InverseProperty("Process")]
    public virtual ICollection<Atqueue> Atqueues { get; set; } = new List<Atqueue>();

    [InverseProperty("SubProcess")]
    public virtual ICollection<Atstack> Atstacks { get; set; } = new List<Atstack>();

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

    [InverseProperty("Process")]
    public virtual ICollection<Attimer> Attimers { get; set; } = new List<Attimer>();

    [InverseProperty("Process")]
    public virtual ICollection<AttrackingDefinition> AttrackingDefinitions { get; set; } = new List<AttrackingDefinition>();

    [InverseProperty("Process")]
    public virtual ICollection<AtworkItem> AtworkItems { get; set; } = new List<AtworkItem>();

    [ForeignKey("Creator")]
    [InverseProperty("AtprocessDefinitionCreatorNavigations")]
    public virtual Atuser? CreatorNavigation { get; set; }

    [ForeignKey("DefaultDocTemplate")]
    [InverseProperty("AtprocessDefinitions")]
    public virtual AtdocumentCabinet DefaultDocTemplateNavigation { get; set; } = null!;

    [ForeignKey("LockedBy")]
    [InverseProperty("AtprocessDefinitionLockedByNavigations")]
    public virtual Atuser? LockedByNavigation { get; set; }

    [ForeignKey("ProcessGroupId")]
    [InverseProperty("AtprocessDefinitions")]
    public virtual AtprocessGroup? ProcessGroup { get; set; }

    [ForeignKey("StartEventId")]
    [InverseProperty("AtprocessDefinitions")]
    public virtual AteventDefinition? StartEvent { get; set; }
}
