"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LlmCallLog = void 0;
const typeorm_1 = require("typeorm");
const swagger_1 = require("@nestjs/swagger");
const base_entity_1 = require("../core-entities/base.entity");
let LlmCallLog = class LlmCallLog extends base_entity_1.BaseEntity {
};
exports.LlmCallLog = LlmCallLog;
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'UUID of the session input that triggered this call',
        format: 'uuid',
    }),
    (0, typeorm_1.Index)(),
    (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
    __metadata("design:type", String)
], LlmCallLog.prototype, "session_input_id", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'LLM provider used for this request',
        enum: ['zai', 'openrouter', 'alibaba', 'ollama', 'openai'],
        example: 'ollama',
    }),
    (0, typeorm_1.Index)(),
    (0, typeorm_1.Column)({ type: 'text' }),
    __metadata("design:type", String)
], LlmCallLog.prototype, "provider", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Model identifier used for this request',
        example: 'ollama/glm-5.1:cloud',
    }),
    (0, typeorm_1.Index)(),
    (0, typeorm_1.Column)({ type: 'text' }),
    __metadata("design:type", String)
], LlmCallLog.prototype, "model_id", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Full request body sent to the provider (JSON string)',
    }),
    (0, typeorm_1.Column)({ type: 'text' }),
    __metadata("design:type", String)
], LlmCallLog.prototype, "request_body", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Full response body received from the provider',
    }),
    (0, typeorm_1.Column)({ type: 'text', nullable: true }),
    __metadata("design:type", String)
], LlmCallLog.prototype, "response_body", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'HTTP status code of the response',
        example: 200,
    }),
    (0, typeorm_1.Index)(),
    (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
    __metadata("design:type", Number)
], LlmCallLog.prototype, "status_code", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Request latency in milliseconds',
        example: 2500,
    }),
    (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
    __metadata("design:type", Number)
], LlmCallLog.prototype, "latency_ms", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Number of input tokens used',
        example: 5000,
    }),
    (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
    __metadata("design:type", Number)
], LlmCallLog.prototype, "input_tokens", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Number of output tokens generated',
        example: 800,
    }),
    (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
    __metadata("design:type", Number)
], LlmCallLog.prototype, "output_tokens", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Number of cached tokens used (for context caching)',
        example: 3000,
    }),
    (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
    __metadata("design:type", Number)
], LlmCallLog.prototype, "cached_tokens", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Error message if the request failed',
    }),
    (0, typeorm_1.Column)({ type: 'text', nullable: true }),
    __metadata("design:type", String)
], LlmCallLog.prototype, "error_message", void 0);
exports.LlmCallLog = LlmCallLog = __decorate([
    (0, typeorm_1.Entity)('llm_call_logs'),
    (0, typeorm_1.Index)('IDX_llm_call_logs_created_at', ['created_at'])
], LlmCallLog);
//# sourceMappingURL=llm-call-log.entity.js.map