using CashLineERP.Contracts.Customers;
using CashLineERP.Contracts.External;
using CashLineERP.Contracts.Parties;
using CashLineERP.Contracts.Suppliers;

namespace CashLineERP.Contracts.Identity;

public sealed record AssignAccountingOfficeClientRequest(
    long PartyId);

public sealed record AccountingOfficeClientAssignmentResponse(
    long AccountingOfficeUserId,
    long PartyId,
    string PartyCode,
    string PartyName,
    string PartyType,
    string? Email,
    string? MobileNumber,
    DateTime AssignedAtUtc,
    long? AssignedByUserId);

public sealed record AccountingOfficeClientWorkspaceResponse(
    BusinessPartyResponse Client,
    SupplierProfileResponse? SupplierProfile,
    CustomerProfileResponse? CustomerProfile,
    IReadOnlyCollection<ExternalOrderResponse> Orders,
    IReadOnlyCollection<ExternalInvoiceResponse> Invoices,
    IReadOnlyCollection<ExternalPaymentResponse> Payments,
    ExternalStatementSummaryResponse StatementSummary,
    IReadOnlyCollection<BusinessPartyComplianceDocumentResponse> ComplianceDocuments,
    IReadOnlyCollection<ExternalCustomerDocumentResponse> CustomerDocuments,
    IReadOnlyCollection<ExternalCustomerServiceRequestResponse> ServiceRequests);

public sealed record AccountingOfficeClientSubmissionPostureResponse(
    BusinessPartyResponse Client,
    bool HasSupplierProfile,
    bool HasCustomerProfile,
    int InvoiceCount,
    int PaymentCount,
    int ComplianceDocumentCount,
    int PendingOnboardingCaseCount,
    int ApprovedOnboardingCaseCount,
    string EtaReadinessCode,
    string SubmissionReadinessSummary);

public sealed record AccountingOfficeDelegatedActivityResponse(
    long AuditEventId,
    string ActionCode,
    long AccountingOfficeUserId,
    string AccountingOfficeLoginName,
    string AccountingOfficeDisplayName,
    long TargetPartyId,
    string TargetPartyCode,
    string TargetPartyName,
    string? DetailsText,
    DateTime OccurredAtUtc);

public sealed record RecordAccountingOfficeClientStatementDeliveryRequest(
    DateTime? DeliveredAtUtc,
    string ChannelCode,
    string? RecipientAddress,
    string DeliveryStatusCode,
    string? Notes);

public sealed record AcknowledgeAccountingOfficeClientStatementDeliveryRequest(
    string AcknowledgmentStatusCode,
    string? Notes);

public sealed record RetryAccountingOfficeClientStatementDeliveryRequest(
    string? ChannelCode,
    string? RecipientAddress,
    string? DeliveryStatusCode,
    string? Notes);

public sealed record GenerateAccountingOfficeClientStatementRequest(
    DateOnly? DateFrom,
    DateOnly? DateTo,
    string? CurrencyCode);
