"use client";

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

export const WorkspacesPage = createExperienceListPage({
  title: "فضاهای کاری",
  breadcrumb: "فضاهای کاری",
  resourceKey: "workspaces",
  permission: "experience.workspaces.view",
  api: experienceApi.workspaces,
  columns: [
    { key: "code", header: "کد" },
    { key: "name", header: "نام" },
    { key: "status", header: "وضعیت", type: "status" },
    { key: "timezone", header: "منطقه زمانی" },
    { key: "created_at", header: "ایجاد", type: "datetime" },
  ],
  createFields: [
    {
      name: "code",
      label: "کد یکتا",
      required: true,
      placeholder: "main-shop",
      hint: "خودتان انتخاب کنید — لاتین/عدد/_/- حداقل ۲ کاراکتر (مثال: main-shop). فارسی و فاصله مجاز نیست.",
    },
    { name: "name", label: "نام نمایشی", required: true, placeholder: "فروشگاه اصلی" },
    { name: "description", label: "توضیح", type: "textarea" },
    {
      name: "status",
      label: "وضعیت",
      type: "select",
      options: [
        { value: "draft", label: "پیش‌نویس" },
        { value: "active", label: "فعال" },
        { value: "inactive", label: "غیرفعال" },
      ],
    },
    { name: "legal_name", label: "نام حقوقی" },
    { name: "timezone", label: "منطقه زمانی", placeholder: "Asia/Tehran" },
    { name: "language", label: "زبان", placeholder: "fa" },
    { name: "currency_code", label: "ارز", placeholder: "IRR", hint: "کد ۳ حرفی ارز (مثل IRR)" },
  ],
});

export default WorkspacesPage;
