using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Expenses.Masters;
using Marco.Pms.Model.Master;
using Marco.Pms.Model.Projects;
using Marco.Pms.Model.TenantModels;
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;

namespace Marco.Pms.Model.Expenses
{
    public class RecurringPayment : TenantRelation
    {
        public Guid Id { get; set; }
        public string Title { get; set; } = default!;
        public string Description { get; set; } = default!;
        public string UIDPrefix { get; set; } = default!;
        public int UIDPostfix { get; set; }
        public string Payee { get; set; } = default!;
        public string NotifyTo { get; set; } = default!;
        public Guid CurrencyId { get; set; }

        [ValidateNever]
        [ForeignKey("CurrencyId")]
        public CurrencyMaster? Currency { get; set; }
        public double Amount { get; set; }
        public DateTime StrikeDate { get; set; }
        public DateTime EndDate { get; set; }
        public DateTime? LatestPRGeneratedAt { get; set; }
        public DateTime? NextStrikeDate { get; set; }
        public Guid? ProjectId { get; set; }

        [ValidateNever]
        [ForeignKey("ProjectId")]
        public Project? Project { get; set; }
        public int PaymentBufferDays { get; set; }
        public Guid? ExpenseCategoryId { get; set; }

        [ValidateNever]
        [ForeignKey("ExpenseCategoryId")]
        public ExpenseCategoryMaster? ExpenseCategory { get; set; }
        public Guid StatusId { get; set; }

        [ValidateNever]
        [ForeignKey("StatusId")]
        public RecurringPaymentStatus? Status { get; set; }
        public PLAN_FREQUENCY Frequency { get; set; }
        public bool IsVariable { get; set; }
        public bool IsActive { get; set; }
        public DateTime CreatedAt { get; set; }
        public Guid CreatedById { get; set; }

        [ValidateNever]
        [ForeignKey("CreatedById")]
        public Employee? CreatedBy { get; set; }
        public DateTime? UpdatedAt { get; set; }
        public Guid? UpdatedById { get; set; }

        [ValidateNever]
        [ForeignKey("UpdatedById")]
        public Employee? UpdatedBy { get; set; }
    }
}
