"use server"

import { getI18n } from "@/i18n/server"
import { ItemService } from "@/services/item.service"
import { RecipientService } from "@/services/recipient.service"

import NewAssetForm from "../_components/new.asset.form"

export default async function NewAssetPage() {
  const items = await ItemService.findAllAssignable()
  const recipients = await RecipientService.findAll()
  const { dictionary } = await getI18n()
  const copy = dictionary.inventory.assets

  return (
    <div className="flex flex-col gap-4">
      <div className="flex items-center justify-between gap-4">
        <h1 className="text-2xl font-bold">{copy.new.title}</h1>
      </div>
      <NewAssetForm
        items={items}
        recipients={recipients}
        formCopy={copy.form}
        schemaCopy={copy.schema}
        statusCopy={copy.status}
        submitButtonCopy={dictionary.common.submitButton}
      />
    </div>
  )
}
