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

namespace IWS5.DatabaseAccess.IwsDataModels;

[Table("ATFieldDefinition")]
[Index("ProcessId", Name = "ATFieldDefinition_IX_ProcessId")]
[Index("ObjectId", Name = "ATFieldDefinition_ObjectId")]
[Index("FieldName", "ProcessId", Name = "UQ_ATFieldDefinition_FieldName_ProcessID", IsUnique = true)]
public partial class AtfieldDefinition
{
    [Key]
    [Column("FieldID")]
    public int FieldId { get; set; }

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

    public int? Index { get; set; }

    [StringLength(64)]
    public string FieldName { get; set; } = null!;

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

    public byte DataType { get; set; }

    public string? InitialValue { get; set; }

    public bool Locked { get; set; }

    public bool Display { get; set; }

    public Guid ObjectId { get; set; }

    [InverseProperty("Field")]
    public virtual ICollection<AtfieldInstanceDate> AtfieldInstanceDates { get; set; } = new List<AtfieldInstanceDate>();

    [InverseProperty("Field")]
    public virtual ICollection<AtfieldInstanceNumber> AtfieldInstanceNumbers { get; set; } = new List<AtfieldInstanceNumber>();

    [InverseProperty("Field")]
    public virtual ICollection<AtfieldInstanceString> AtfieldInstanceStrings { get; set; } = new List<AtfieldInstanceString>();

    [InverseProperty("Field")]
    public virtual ICollection<AtfieldInstanceOption> AtfieldInstanceOptions { get; set; } = new List<AtfieldInstanceOption>();

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