"use client";

import { createExperienceListPage } from "@/modules/experience/components/ExperienceListCrudPage";
import { experienceApi } from "@/modules/experience/services/experience-api";

export const PagesPage = createExperienceListPage({
  title: "صفحات",
  breadcrumb: "صفحات",
  resourceKey: "pages",
  permission: "experience.pages.view",
  api: experienceApi.pages,
  columns: [
    { key: "title", header: "عنوان" },
    { key: "slug", header: "اسلاگ" },
    { key: "page_type", header: "نوع" },
    { key: "publish_status", header: "انتشار", type: "status" },
    { key: "created_at", header: "ایجاد", type: "datetime" },
  ],
  createFields: [
    { name: "code", label: "کد", required: true },
    { name: "title", label: "عنوان", required: true },
    { name: "slug", label: "اسلاگ", required: true },
    { name: "page_type", label: "نوع", type: "select", options: [
      { value: "landing", label: "لندینگ" },
      { value: "content", label: "محتوا" },
    ]},
  ],
  detailHref: (row) => row.id ? `/experience/pages/${row.id}/builder` : null,
});

export default PagesPage;
