content: import System.Random (randomRIO)
  import Data.Time.Clock (getCurrentTime)
  import System.IO
  import Data.Aeson (encode)
  import qualified Data.ByteString.Lazy as B
  
  -- Maslahatlar royxati
  adviceList :: [(String, [String])]
  adviceList =
      [ ("hursand", 
          ["Zor! Ozingizni yaxshi his qilayotganingizdan xursandman!",
           "Bugun yanada quvnoq bolish uchun dostlaringiz bilan gaplashing!",
           "Quvnoqligingizni boshqalarga ham ulashing!"])
      , ("xafa",
          ["Hamma narsaning yechimi bor. Shunchaki sabrli boling.",
           "Bir oz dam oling va xotirjam boling.",
           "Tashvishlaringizni yaqinlaringiz bilan baham koring."])
      , ("asabiy",
          ["Chuqur nafas oling va asta-sekin chiqaring...",
           "Bir oz musiqa tinglang yoki tabiatda sayr qiling.",
           "Tinchlanish uchun meditatsiya yoki sport bilan shugullaning."])
      ]
  
  -- Foydalanuvchiga maslahat berish
  getAdvice :: String -> IO String
  getAdvice mood =
      case lookup mood adviceList of
          Just advices -> do
              index <- randomRIO (0, length advices - 1)
              return (advices !! index)
          Nothing -> return "Men sizni tushuna olmadim. Iltimos, kayfiyatingizni aniqroq yozing!"
  
  -- JSON faylga saqlash
  saveMood :: String -> IO ()
  saveMood mood = do
      time <- getCurrentTime
      let logEntry = encode [("mood", mood), ("timestamp", show time)]
      B.appendFile "mood_log.json" logEntry
      putStrLn "? Kayfiyat tarixga yozildi."
  
  -- Asosiy funksiya
  main :: IO ()
  main = do
      putStrLn "?? AI Shaxsiy Psixolog! Siz bilan suhbatlashaman."
      putStrLn "?? Kayfiyatingiz qanday? (hursand, xafa, asabiy)"
      putStr "?? Javobingiz: "
      hFlush stdout
      mood <- getLine
      advice <- getAdvice mood
      putStrLn $ "\n?? AI: " ++ advice
      saveMood mood
  