<script setup lang="ts">
const origin = defineModel<string>('origin', { default: '' })
const budget = defineModel<number | null>('budget', { default: null })
const directOnly = defineModel<boolean>('directOnly', { default: false })

defineProps<{
  inspirationCount: number
}>()
</script>

<template>
  <UCard>
    <div class="flex flex-wrap items-end gap-4">
      <UFormField label="Origen" class="w-48">
        <SearchAirportInput v-model="origin" placeholder="MAD" icon="i-lucide-plane-takeoff" />
      </UFormField>

      <div class="flex-1 min-w-48">
        <div class="flex justify-between text-sm mb-1">
          <span class="text-muted">Presupuesto</span>
          <span class="font-semibold">{{ budget ? `${budget}€` : 'Sin limite' }}</span>
        </div>
        <URange :model-value="budget || 500" :min="20" :max="1000" :step="10" @update:model-value="budget = $event" />
      </div>

      <UButton
        :label="directOnly ? 'Solo directos' : 'Todos'"
        :icon="directOnly ? 'i-lucide-arrow-right' : 'i-lucide-git-branch'"
        :color="directOnly ? 'primary' : 'neutral'"
        :variant="directOnly ? 'soft' : 'ghost'"
        size="sm"
        @click="directOnly = !directOnly"
      />

      <p class="text-sm text-muted">{{ inspirationCount }} destinos</p>
    </div>
  </UCard>
</template>
