package org.example.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.time.LocalDateTime;

@JsonIgnoreProperties(
        ignoreUnknown = true
)
@Data
public class TransactionRequest {
    @JsonProperty("transactionId")
    private String transactionId;

    @JsonProperty("amount")
    private Amount amount;
    @JsonProperty("currency")
    private String currency;
    @JsonProperty("transactionType")
    private String transactionType;
    @JsonProperty("cardType")
    private String cardType;
    @JsonProperty("cardNumber")
    private String cardNumber;
    @JsonProperty("merchantId")
    private String merchantId;
    @JsonProperty("terminalId")
    private String terminalId;
    @JsonProperty("customerId")
    private String customerId;
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private LocalDateTime timestamp;


    @JsonIgnoreProperties(
            ignoreUnknown = true
    )
    public static class Amount {
        @JsonProperty("value")
        private String value;
        @JsonProperty("currency")
        private String currency;

        // Getters and setters
        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public String getCurrency() {
            return currency;
        }

        public void setCurrency(String currency) {
            this.currency = currency;
        }
    }

}