using Books.Api.Domain.FiscalYears;
using EventFlow.Commands;

namespace Books.Api.Commands.FiscalYears;

public class CreateFiscalYearCommand(
    FiscalYearId aggregateId,
    string companyId,
    string name,
    DateOnly startDate,
    DateOnly endDate,
    bool isFirstFiscalYear = false,
    bool isReorganization = false)
    : Command<FiscalYearAggregate, FiscalYearId>(aggregateId)
{
    public string CompanyId { get; } = companyId;
    public string Name { get; } = name;
    public DateOnly StartDate { get; } = startDate;
    public DateOnly EndDate { get; } = endDate;

    /// <summary>
    /// Per Årsregnskabsloven §15: First fiscal year can be shorter than 12 months (6-18 months allowed)
    /// </summary>
    public bool IsFirstFiscalYear { get; } = isFirstFiscalYear;

    /// <summary>
    /// Per Årsregnskabsloven §15: Reorganization allows fiscal year up to 18 months
    /// </summary>
    public bool IsReorganization { get; } = isReorganization;
}

public class CloseFiscalYearCommand(
    FiscalYearId aggregateId,
    string closedBy)
    : Command<FiscalYearAggregate, FiscalYearId>(aggregateId)
{
    public string ClosedBy { get; } = closedBy;
}

public class ReopenFiscalYearCommand(
    FiscalYearId aggregateId,
    string reopenedBy)
    : Command<FiscalYearAggregate, FiscalYearId>(aggregateId)
{
    public string ReopenedBy { get; } = reopenedBy;
}

public class LockFiscalYearCommand(
    FiscalYearId aggregateId,
    string lockedBy)
    : Command<FiscalYearAggregate, FiscalYearId>(aggregateId)
{
    public string LockedBy { get; } = lockedBy;
}

public class MarkOpeningBalancePostedCommand(FiscalYearId aggregateId)
    : Command<FiscalYearAggregate, FiscalYearId>(aggregateId);
