from datetime import datetime
from enum import IntEnum
from typing import Optional

from sqlalchemy import Column, Integer, String, DateTime, Enum, Index, Table, ForeignKey
from pydantic import BaseModel
from sqlalchemy.orm import relationship, backref

from app.models.base_model import Base

class CommonLlmModel(Base):
    __tablename__ = 'common_llm'
    __mapper_args__ = {
        # "order_by": 'SEQ'
    }

    id = Column(String(36), primary_key=True, nullable=False)
    llm_factory = Column(String(128), nullable=False)
    model_type = Column(String(128), nullable=False)
    llm_name = Column(String(128), nullable=False)
    api_key = Column(String(1024), nullable=True)
    api_base = Column(String(255), nullable=True)

    def to_json(self):
        json = {
            'id': self.id,
            'llm_factory': self.llm_factory,
            'model_type': self.model_type,
            'llm_name': self.llm_name,
            'api_key': self.api_key,
            'api_base': self.api_base,
        }
        return json