<!-- front-end/app/pages/gestao/contratos.vue -->
<script setup lang="ts">
import { contratos } from '~/data/mock/contratos'

const columns = [
  { id: 'numero', accessorKey: 'numero', header: 'Nº Contrato' },
  { id: 'orgao', accessorKey: 'orgao', header: 'Órgão' },
  { id: 'valor', accessorKey: 'valor', header: 'Valor' },
  { id: 'dataInicio', accessorKey: 'dataInicio', header: 'Início' },
  { id: 'dataFim', accessorKey: 'dataFim', header: 'Término' },
  { id: 'fiscalContrato', accessorKey: 'fiscalContrato', header: 'Fiscal' },
  { id: 'sla', accessorKey: 'sla', header: 'SLA' },
]
</script>

<template>
  <div class="page">
    <AppTopbar title="Contratos" breadcrumb="Gestão · Contratos">
      <template #actions>
        <UButton size="sm" class="btn-primary">+ Novo Contrato</UButton>
      </template>
    </AppTopbar>
    <div class="content">
      <div class="card">
        <UTable :data="contratos" :columns="columns">
          <template #valor-cell="{ row }">
            {{ new Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL', maximumFractionDigits: 0 }).format(row.original.valor) }}
          </template>
          <template #dataInicio-cell="{ row }">{{ row.original.dataInicio.toLocaleDateString('pt-BR') }}</template>
          <template #dataFim-cell="{ row }">{{ row.original.dataFim.toLocaleDateString('pt-BR') }}</template>
        </UTable>
      </div>
    </div>
  </div>
</template>

<style scoped>
.page { display: flex; flex-direction: column; height: 100vh; }
.content { padding: 20px 22px; flex: 1; overflow-y: auto; }
.card { background: white; border-radius: 11px; border: 1px solid #e2e8f0; overflow: hidden; }
.btn-primary { background: linear-gradient(135deg, #667eea, #764ba2) !important; }
</style>
