package com.yaoai.api.dto.billing;

import com.yaoai.domain.entity.BillingRecord;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
public class BillingRecordDTO {

    private Long id;
    private Long projectId;
    private String projectName;
    private String operation;
    private String modality;
    private String modelProvider;
    private String modelId;
    private String modelName;
    private Integer unitCount;
    private Boolean success;
    private String billingMeta;
    private BigDecimal credits;
    private String billingMode;
    private String refId;
    private LocalDateTime createdAt;

    public static BillingRecordDTO from(BillingRecord r) {
        BillingRecordDTO dto = new BillingRecordDTO();
        dto.setId(r.getId());
        dto.setProjectId(r.getProjectId());
        dto.setOperation(r.getOperation());
        dto.setModality(r.getModality());
        dto.setModelProvider(r.getModelProvider());
        dto.setModelId(r.getModelId());
        dto.setModelName(r.getModelName());
        dto.setUnitCount(r.getUnitCount());
        dto.setSuccess(r.getSuccess());
        dto.setBillingMeta(r.getBillingMeta());
        dto.setCredits(r.getCredits());
        dto.setBillingMode(r.getBillingMode());
        dto.setRefId(r.getRefId());
        dto.setCreatedAt(r.getCreatedAt());
        return dto;
    }
}
