package com.erp.ai.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.Builder;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

import java.time.LocalDateTime;

/**
 * AI对话实体
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("ai_conversations")
public class AIConversation {

    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 租户ID
     */
    private Long tenantId;

    /**
     * 对话标题
     */
    private String title;

    /**
     * AI模型
     */
    private String model;

    /**
     * AI服务提供商
     */
    private String service;

    /**
     * 对话状态: active, archived, deleted
     */
    private String status;

    /**
     * 消息数量
     */
    @Builder.Default
    private Integer messageCount = 0;

    /**
     * 总Token数量
     */
    @Builder.Default
    private Long totalTokens = 0L;

    /**
     * 最后消息时间
     */
    private LocalDateTime lastMessageAt;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    /**
     * 逻辑删除标记
     */
    @TableLogic
    private Integer deleted;
}
