using e_suite.Database.Core.Tables.Domain;
using System.ComponentModel.DataAnnotations;
using e_suite.Database.Core.Tables.UserManager;
using e_suite.Workflow.Core.Interfaces;
using eSuite.Core.Workflow;

namespace e_suite.Workflow.Core;

public class TaskAssignee : ITaskAssignee, IValidatableObject
{
    public Role? Role { get; set; }
    public User? User { get; set; }
    public Raci Raci { get; set; }

    public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
    {
        if (!((Role != null) ^ (User != null))) //Role Xor Contact means either must be set, but not both the same
        {
            yield return new ValidationResult(
                "Either Role or Contact must be set, but not both.",
                [nameof(Role), nameof(User)]
            );
        }
    }

}