package com.yutou.qqbot.data.gpt;

import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;

import java.util.List;

@Data
public class OpenAiBean {
    @JSONField(name = "id")
    private String id;

    @JSONField(name = "choices")
    private List<Choice> choices;

    @JSONField(name = "tool_calls")
    private List<ToolCall> toolCalls;

    @JSONField(name = "usage")
    private Usage usage;

    @JSONField(name = "created")
    private long created;

    @JSONField(name = "model")
    private String model;

    @JSONField(name = "object")
    private String object;

    @JSONField(name = "system_fingerprint")
    private String systemFingerprint;

    @Data
    public static class Choice {
        @JSONField(name = "index")
        private int index;

        @JSONField(name = "message")
        private Message message;

        @JSONField(name = "finish_reason")
        private String finishReason;
    }

    @Data
    public static class Message {
        @JSONField(name = "role")
        private String role;

        @JSONField(name = "content")
        private String content;

        @JSONField(name = "reasoning_content")
        private String reasoningContent;
    }

    @Data
    public static class ToolCall {
        @JSONField(name = "id")
        private String id;

        @JSONField(name = "type")
        private String type;

        @JSONField(name = "function")
        private Function function;
    }

    @Data
    public static class Function {
        @JSONField(name = "name")
        private String name;

        @JSONField(name = "arguments")
        private String arguments;
    }

    @Data
    public static class Usage {
        @JSONField(name = "prompt_tokens")
        private int promptTokens;

        @JSONField(name = "completion_tokens")
        private int completionTokens;

        @JSONField(name = "total_tokens")
        private int totalTokens;
    }
}
