using System.Text.Json;
using System.Text.Json.Serialization;

namespace Csob.Models;

public sealed class PaymentIdentification
{
    /// <summary>Unique instruction id assigned by the TPP (idempotency key). Max 35 chars.</summary>
    public string? InstructionIdentification { get; set; }
    public string? EndToEndIdentification { get; set; }
}

/// <summary>
/// Payment initiation request (<c>POST /my/payments</c>). Covers domestic (DMCT) and SEPA (ESCT)
/// payments — SEPA-only fields (creditor address, agent, ultimate parties, purpose) are optional.
/// Any additional COBS field not modelled here is preserved via <see cref="AdditionalData"/>.
/// </summary>
public sealed class PaymentInitiationRequest
{
    public PaymentIdentification? PaymentIdentification { get; set; }
    public PaymentTypeInformation? PaymentTypeInformation { get; set; }
    public AmountContainer Amount { get; set; } = new();
    public string? RequestedExecutionDate { get; set; }

    public Party? UltimateDebtor { get; set; }
    public AccountReference DebtorAccount { get; set; } = new();
    public Agent? CreditorAgent { get; set; }
    public Party? Creditor { get; set; }
    public AccountReference CreditorAccount { get; set; } = new();
    public Party? UltimateCreditor { get; set; }

    public RemittanceInformation? RemittanceInformation { get; set; }
    public Purpose? Purpose { get; set; }

    /// <summary>Any COBS fields not explicitly modelled are forwarded to ČSOB unchanged.</summary>
    [JsonExtensionData]
    public Dictionary<string, JsonElement>? AdditionalData { get; set; }
}
