import { useParams } from "react-router-dom";

import { Matrix } from "@/common/components/Matrix/Matrix";
import { PhotoModel } from "@/contracts/client.schemas";

export const PhotoListPage = () => {
	const { assetId } = useParams();
	if (!assetId) {
		throw new Error("Asset id is required");
	}

	return (
		<Matrix<PhotoModel>
			baseUrl="/api/photos"
			title="Photos"
			columns={[
				{
					name: "name",
					title: "Name",
				},
			]}
			getModelTitle={(model) => model.name}
			notificationMethodPrefix="PHOTOS"
			filters={{ assetId }}
			canCreate={true}
			canRemove={true}
			canView={true}
		/>
	);
};
