package com.yaoai.api.dto.asset;

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

import java.time.LocalDateTime;

@Data
public class AssetDTO {

    private Long id;
    private Long projectId;
    private String name;
    private String originalName;
    private String assetType;
    private String mimeType;
    private Long fileSize;
    private String url;
    private LocalDateTime createdAt;

    public static AssetDTO from(ProjectAsset a, String url) {
        AssetDTO dto = new AssetDTO();
        dto.setId(a.getId());
        dto.setProjectId(a.getProjectId());
        dto.setName(a.getName());
        dto.setOriginalName(a.getOriginalName());
        dto.setAssetType(a.getAssetType());
        dto.setMimeType(a.getMimeType());
        dto.setFileSize(a.getFileSize());
        dto.setUrl(url);
        dto.setCreatedAt(a.getCreatedAt());
        return dto;
    }
}
