from enum import StrEnum

class ContentType(StrEnum):
   """Lowercase characters must be used"""
   IMAGE_BASE64      = "image_base64"
   IMAGE_URL         = "image_url"
   PDF_BASE64        = "pdf_base64"
   PDF_URL           = "pdf_url"
   PLAIN_TEXT_BASE64 = "plain_text_base64"
   PLAIN_TEXT_URL    = "plain_text_url"
   TEXT              = "text"
   
   @classmethod
   def to_dict(self) -> str:
       return {item.name: item.value for item in ContentType}

   @classmethod
   def get_type_list(self) -> str:
       return [item.value for item in ContentType]

class ContentRole(StrEnum):
   """
   system:
      Messages that establish the assistant's behavior. These messages typically define the rules and tone the assistant should follow during the conversation.
      Consistency: Ensures the assistant follows a consistent behavior throughout the conversation.
      Personalization: Allows customization of the interaction according to the specific needs of the user or application.
      Context: Sets the initial context, which is crucial for the assistant to understand the purpose of the conversation and act accordingly.

   user:
      Messages sent by the user. They represent the user's queries, commands, or interactions with the assistant.

   assistant:
      Responses generated by the assistant. These messages contain the responses that the language model generates based on the previous messages in the conversation.
   """
   SYSTEM = "system"
   USER = "user"
   ASSISTANT = "assistant"

   def find_by_key(value)->str|None:
      for variable in ContentRole:
         if str(variable.name).lower() == str(value).lower():
               return variable.value   
