package com.sonic.lion.domain.input;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.time.ZoneOffset;

@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class IOSReceiptInput {

    private String productId;
    private String transactionId;
    private String originalTransactionId;
    private Long purchase_date_ms;
    private Long expires_date_ms;

    public String getSubscriptionId(){
        return originalTransactionId;
    }

    public LocalDateTime getPurchaseDate(){
        LocalDateTime purchaseDate = LocalDateTime.ofEpochSecond(purchase_date_ms/1000, 0, ZoneOffset.ofHours(8));
        return purchaseDate;
    }

    public LocalDateTime getExpiresDate(){
        LocalDateTime expiresDate = LocalDateTime.ofEpochSecond(expires_date_ms/1000, 0, ZoneOffset.ofHours(8));
        return expiresDate;
    }

}
