"use client";

import { createDeliveryListPage } from "@/modules/delivery/components/DeliveryListCrudPage";
import { deliveryApi } from "@/modules/delivery/services/delivery-api";

export const BranchesPage = createDeliveryListPage({
  title: "شعب و هاب‌ها",
  breadcrumb: "شعب",
  resourceKey: "hubs",
  permission: "delivery.hubs.view",
  api: deliveryApi.hubs,
  columns: [
    { key: "code", header: "کد" },
    { key: "name", header: "نام" },
    { key: "status", header: "وضعیت", type: "status" },
    { key: "created_at", header: "ایجاد", type: "datetime" },
  ],
  createFields: [
    { name: "organization_id", label: "سازمان", type: "organization", required: true },
    { name: "code", label: "کد", required: true },
    { name: "name", label: "نام", required: true },
    { name: "status", label: "وضعیت", type: "select", options: [
      { value: "active", label: "فعال" },
      { value: "draft", label: "پیش‌نویس" },
    ]},
  ],
});

export default BranchesPage;
