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

namespace e_suite.Database.Core.Tables.Forms;

[DisplayName("Form Template")]
[Table("FormTemplates", Schema = "Forms")]
[Index(nameof(Name), IsUnique = true)]
[Index(nameof(Guid), IsUnique = true)]
public class FormTemplate : IGeneralId, ISoftDeletable
{
    [Key]
    public long Id { get; set; }

    [AuditName]
    [Required]
    public string Name { get; set; } = string.Empty;

    [AuditSoftDelete(true)]
    [Required]
    [DefaultValue(false)]
    public bool Deleted { get; set; } = false;

    [Required]
    public Guid Guid { get; set; } = Guid.NewGuid();

    [AuditLastUpdated]
    public DateTimeOffset LastUpdated { get; set; }

    public ICollection<FormTemplateVersion> Versions { get; set; } = [];
}