import { atom } from 'jotai'

/**
 * 自动播放语音
 */
export const playVoiceAtom = atom({
  voiceType: '',
  dialogueSpeechRate: 0,
  dialoguePitch: 0,
  isAutoPlayVoice: false,
})

/**
 * 抽屉状态类型
 */
export interface DrawerState {
  open: boolean
  timestamp: number
}

/**
 * 创建抽屉打开状态的辅助函数
 */
export const createDrawerOpenState = (open: boolean): DrawerState => ({
  open,
  timestamp: Date.now(),
})

/**
 * 是否打开发送礼物抽屉
 */
export const isSendGiftsDrawerOpenAtom = atom<DrawerState>({ open: false, timestamp: 0 })

/**
 * 是否打开 crush level 抽屉
 */
export const isCrushLevelDrawerOpenAtom = atom<DrawerState>({ open: false, timestamp: 0 })

/**
 * 是否打开 crush level 获取抽屉
 */
export const isCrushLevelRetrieveDrawerOpenAtom = atom<DrawerState>({ open: false, timestamp: 0 })

/**
 * 是否打开 chat profile 抽屉
 */
export const isChatProfileDrawerOpenAtom = atom<DrawerState>({ open: false, timestamp: 0 })

/**
 * 是否打开 chat profile 编辑抽屉
 */
export const isChatProfileEditDrawerOpenAtom = atom<DrawerState>({ open: false, timestamp: 0 })

/**
 * 是否打开 chat model 抽屉
 */
export const isChatModelDrawerOpenAtom = atom<DrawerState>({ open: false, timestamp: 0 })

/**
 * 是否打开 chat buttle 抽屉
 */
export const isChatButtleDrawerOpenAtom = atom<DrawerState>({ open: false, timestamp: 0 })

/**
 * 是否打开 chat background 抽屉
 */
export const isChatBackgroundDrawerOpenAtom = atom<DrawerState>({ open: false, timestamp: 0 })
