package com.yutou.napcat.handle;

import com.alibaba.fastjson2.annotation.JSONField;
import com.yutou.qqbot.utlis.Base64Tools;
import lombok.Data;

import java.io.File;

public class Image extends BaseHandle<Image.ImageInfo> {

    public Image() {
        super("image");
    }

    public Image(String imageUrl) {
        super("image");
        data = new ImageInfo(imageUrl);
    }
    public Image(File imageFile){
        super("image");
        data=new ImageInfo("base64://"+ Base64Tools.encode(imageFile));
    }

    @Data
    public static class ImageInfo {
        String file;
        String url;
        @JSONField(name = "file_size")
        String fileSize;

        public ImageInfo(String file) {
            this.file = file;
        }
    }
}
