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

namespace IWS5.DatabaseAccess.IwsDataModels;

[Table("ATEventDefinition")]
[Index("ExpirationInterval", Name = "ATEventDefinition_IX_Expire")]
[Index("ProcessId", "EventName", "Action", Name = "UK_EventDefinition_Process_EventName_Action", IsUnique = true)]
public partial class AteventDefinition
{
    [Key]
    [Column("EventID")]
    public int EventId { get; set; }

    [Column("ProcessID")]
    public int ProcessId { get; set; }

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

    public int? PositionX { get; set; }

    public int? PositionY { get; set; }

    [Column("EventTypeID")]
    public int EventTypeId { get; set; }

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

    public int? ExpirationInterval { get; set; }

    [Column("JoinEventID")]
    public int? JoinEventId { get; set; }

    public int ProcessAtServer { get; set; }

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

    public int? ScriptLanguage { get; set; }

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

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

    [Column("NextEventID")]
    public int? NextEventId { get; set; }

    [StringLength(64)]
    public string? Action { get; set; }

    [InverseProperty("Event")]
    public virtual ICollection<Atbutton> Atbuttons { get; set; } = new List<Atbutton>();

    [InverseProperty("Event")]
    public virtual ICollection<AtconvertEvent> AtconvertEvents { get; set; } = new List<AtconvertEvent>();

    [InverseProperty("Event")]
    public virtual ICollection<AteventTriggerTemplate> AteventTriggerTemplates { get; set; } = new List<AteventTriggerTemplate>();

    [InverseProperty("Event")]
    public virtual ICollection<AtexportEvent> AtexportEvents { get; set; } = new List<AtexportEvent>();

    [InverseProperty("Event")]
    public virtual ICollection<AtinboxEvent> AtinboxEvents { get; set; } = new List<AtinboxEvent>();

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

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

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

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

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

    [InverseProperty("JoinEvent")]
    public virtual ICollection<Atsplit> Atsplits { get; set; } = new List<Atsplit>();

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

    [InverseProperty("Event")]
    public virtual ICollection<AttaskDefinition> AttaskDefinitions { get; set; } = new List<AttaskDefinition>();

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

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

    [InverseProperty("Event")]
    public virtual ICollection<AtworkItemReference> AtworkItemReferenceEvents { get; set; } = new List<AtworkItemReference>();

    [InverseProperty("SuccessorNavigation")]
    public virtual ICollection<AtworkItemReference> AtworkItemReferenceSuccessorNavigations { get; set; } = new List<AtworkItemReference>();

    [ForeignKey("EventTypeId")]
    [InverseProperty("AteventDefinitions")]
    public virtual AteventType EventType { get; set; } = null!;

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

    [ForeignKey("JoinEventId")]
    [InverseProperty("InverseJoinEvent")]
    public virtual AteventDefinition? JoinEvent { get; set; }

    [ForeignKey("ProcessId")]
    [InverseProperty("AteventDefinitions")]
    public virtual AtprocessDefinition Process { get; set; } = null!;

    [ForeignKey("Server")]
    [InverseProperty("AteventDefinitions")]
    public virtual Atserver AssignedServer { get; set; } = null!;
}
