<script setup>
import RuntimeBadge from './RuntimeBadge.vue'

defineProps({
  runtimeText: {
    type: String,
    default: '',
  },
  runtimeTagType: {
    type: String,
    default: 'default',
  },
  onStartMove: {
    type: Function,
    required: true,
  },
  onMinimize: {
    type: Function,
    required: true,
  },
  onMaximizeOrRestore: {
    type: Function,
    required: true,
  },
  onClose: {
    type: Function,
    required: true,
  },
  onOpenDevtools: {
    type: Function,
    required: true,
  },
  onRestartApp: {
    type: Function,
    required: true,
  },
})
</script>

<template>
  <div class="inner drag-region" data-tauri-drag-region @mousedown="onStartMove" @dblclick="onMaximizeOrRestore">
    <div class="flex items-center gap-3" data-tauri-drag-region>
      <div class="w-8 h-8 rounded-lg bg-cyan-100 text-cyan-700 flex items-center justify-center font-bold">识</div>
      <div class="text-[16px] font-semibold text-slate-800">识流 AI 助手</div>
      <RuntimeBadge :type="runtimeTagType" :text="runtimeText" />
    </div>
    <div class="window-actions" @mousedown.stop>
      <button class="win-btn" type="button" @click.stop="onOpenDevtools">调</button>
      <button class="win-btn" type="button" @click.stop="onRestartApp">重</button>
      <button class="win-btn" type="button" @click.stop="onMinimize">—</button>
      <button class="win-btn" type="button" @click.stop="onMaximizeOrRestore">□</button>
      <button class="win-btn close" type="button" @click.stop="onClose">✕</button>
    </div>
  </div>
</template>
