using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using e_suite.Database.Audit.Attributes;
using e_suite.Database.Audit.Models;
using Microsoft.EntityFrameworkCore;

namespace e_suite.Database.Core.Tables.Miscellaneous;

[NoAudit]
[Table("ExternalSystems", Schema = "Miscellaneous")]
[Index(nameof(SystemName), IsUnique = true)]
public class ExternalSystem : IId
{
    [Key]
    public long Id { get; set; }

    [Required]
    [MaxLength(200)]
    public string SystemName { get; set; } = string.Empty;

    public static void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<ExternalSystem>().HasData(new ExternalSystem
        {
            Id = 1,
            SystemName = "e-flow"
        });
    }
}