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

namespace e_suite.Database.Core.Tables.Workflow;

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

    [Required]
    public Guid Guid { get; set; }

    [AuditName]
    [Required]
    public string Name { get; set; } = string.Empty;
    
    [AuditSoftDelete(true)]
    [Required]
    [DefaultValue(false)]
    public bool Deleted { get; set; }

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

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