'use client';
import { useState } from 'react';
import { Checkbox } from '@/components/ui/checkbox';
import { Button } from '@/components/ui/button';
import { cn } from '@/lib/utils';
import { useStreamChatStore } from '@/app/(main)/chat/[id]/stream-chat';

type TokenOption = {
  value: number;
  label: string;
};

export default function MaxToken() {
  const chatSetting = useStreamChatStore((store) => store.chatSetting);
  const setChatSetting = useStreamChatStore((store) => store.setChatSetting);

  const tokenOptions: TokenOption[] = [
    { value: 800, label: '800' },
    { value: 1000, label: '1000' },
    { value: 1200, label: '1200' },
    { value: 1500, label: '1500' },
  ];

  return (
    <div className="flex h-full flex-col">
      <div className="flex-1">
        <div className="flex flex-col gap-3">
          {tokenOptions.map((option) => (
            <div
              key={option.value}
              className={cn(
                'bg-surface-element-normal flex h-12 cursor-pointer items-center justify-between rounded-lg px-5 transition-colors',
                chatSetting.maximumReplies === option.value && 'bg-surface-element-hover'
              )}
              onClick={() => setChatSetting({ maximumReplies: option.value })}
            >
              <div className="txt-title-s">{option.label}</div>
              <Checkbox shape="round" checked={chatSetting.maximumReplies === option.value} />
            </div>
          ))}
        </div>
      </div>
    </div>
  );
}
