<?php

namespace WeDevs\AppBridge\Integrations\Dokan\Notifications;

/**
 * Canonical Vendor App push-notification event catalog.
 *
 * Lives with the Dokan integration since these events target the vendor
 * mobile app. Consumed by:
 *   - {@see \WeDevs\AppBridge\Integrations\Dokan\SettingsSchema} (editor UI)
 *   - {@see \WeDevs\AppBridge\Core\Notifications\EventRegistry} (dispatch),
 *     wired in via DokanIntegration::event_catalogs().
 */
class VendorEventCatalog {

	/**
	 * @return array<string, array{label:string, description?:string, events:array<int, array<string, mixed>>}>
	 */
	public static function categories(): array {
		return [
			'order'    => [
				'label'       => __( 'Order', 'app-bridge' ),
				'description' => __( 'New orders, cancellations, and status changes on vendor-owned orders.', 'app-bridge' ),
				'events'      => [
					[
						'id'           => 'order_new',
						'label'        => __( 'New Order', 'app-bridge' ),
						'channel'      => 'order',
						'screen_route' => 'vendor_order_details',
						'title'        => __( 'New Order Received!', 'app-bridge' ),
						'body'         => __( 'You have a new order #{order_number} for {amount}. Review and process it now.', 'app-bridge' ),
					],
					[
						'id'           => 'order_cancelled_by_customer',
						'label'        => __( 'Order Cancelled by Customer', 'app-bridge' ),
						'channel'      => 'order',
						'screen_route' => 'vendor_order_details',
						'title'        => __( 'Order Cancelled by Customer', 'app-bridge' ),
						'body'         => __( 'Order #{order_number} has been cancelled by the customer.', 'app-bridge' ),
					],
					[
						'id'           => 'order_cancelled_by_admin',
						'label'        => __( 'Order Cancelled by Admin', 'app-bridge' ),
						'channel'      => 'important',
						'screen_route' => 'vendor_order_details',
						'title'        => __( 'Order Cancelled by Admin', 'app-bridge' ),
						'body'         => __( 'Order #{order_number} has been cancelled by the platform admin.', 'app-bridge' ),
					],
					[
						'id'           => 'order_status_changed',
						'label'        => __( 'Order Status Changed', 'app-bridge' ),
						'channel'      => 'order',
						'screen_route' => 'vendor_order_details',
						'title'        => __( 'Order Status Updated', 'app-bridge' ),
						'body'         => __( "The status of order #{order_number} has been updated to '{status}'.", 'app-bridge' ),
					],
					[
						'id'           => 'order_refund_requested',
						'label'        => __( 'Refund Requested', 'app-bridge' ),
						'channel'      => 'refund',
						'screen_route' => 'vendor_refund_details',
						'title'        => __( 'Refund Request from Customer', 'app-bridge' ),
						'body'         => __( 'A customer has requested a refund for order #{order_number}. Please review it.', 'app-bridge' ),
					],
					[
						'id'           => 'order_replacement_requested',
						'label'        => __( 'Replacement Requested', 'app-bridge' ),
						'channel'      => 'refund',
						'screen_route' => 'vendor_rma_details',
						'title'        => __( 'Replacement Request from Customer', 'app-bridge' ),
						'body'         => __( 'A customer has requested a replacement for order #{order_number}. Please review it.', 'app-bridge' ),
					],
					[
						'id'           => 'order_store_credit_requested',
						'label'        => __( 'Store Credit Requested', 'app-bridge' ),
						'channel'      => 'refund',
						'screen_route' => 'vendor_rma_details',
						'title'        => __( 'Store Credit Request from Customer', 'app-bridge' ),
						'body'         => __( 'A customer has requested store credit for order #{order_number}. Please review it.', 'app-bridge' ),
					],
				],
			],
			'withdraw' => [
				'label'       => __( 'Withdraw / Payout', 'app-bridge' ),
				'description' => __( 'High-priority payout lifecycle alerts for vendors.', 'app-bridge' ),
				'events'      => [
					[
						'id'           => 'withdraw_request_submitted',
						'label'        => __( 'Withdraw Request Submitted', 'app-bridge' ),
						'channel'      => 'important',
						'screen_route' => 'vendor_withdraw',
						'title'        => __( 'Withdraw Request Submitted', 'app-bridge' ),
						'body'         => __( 'Your withdrawal request of {amount} has been submitted and is pending approval.', 'app-bridge' ),
					],
					[
						'id'           => 'withdraw_approved',
						'label'        => __( 'Withdraw Approved', 'app-bridge' ),
						'channel'      => 'important',
						'screen_route' => 'vendor_withdraw',
						'title'        => __( 'Withdrawal Approved', 'app-bridge' ),
						'body'         => __( 'Your withdrawal request of {amount} has been approved and is being processed.', 'app-bridge' ),
					],
					[
						'id'           => 'withdraw_rejected',
						'label'        => __( 'Withdraw Rejected', 'app-bridge' ),
						'channel'      => 'important',
						'screen_route' => 'vendor_withdraw',
						'title'        => __( 'Withdrawal Rejected', 'app-bridge' ),
						'body'         => __( 'Your withdrawal request of {amount} was rejected. Contact support for details.', 'app-bridge' ),
					],
					[
						'id'           => 'withdraw_completed',
						'label'        => __( 'Payout Completed', 'app-bridge' ),
						'channel'      => 'important',
						'screen_route' => 'vendor_withdraw',
						'title'        => __( 'Payout Sent!', 'app-bridge' ),
						'body'         => __( 'Your payout of {amount} has been successfully transferred to your account.', 'app-bridge' ),
					],
				],
			],
			'product'  => [
				'label'       => __( 'Product', 'app-bridge' ),
				'description' => __( 'Product approval, rejection, and stock alerts.', 'app-bridge' ),
				'events'      => [
					[
						'id'           => 'product_pending_review',
						'label'        => __( 'Pending Review', 'app-bridge' ),
						'channel'      => 'product',
						'screen_route' => 'vendor_product_details',
						'title'        => __( 'Product Under Review', 'app-bridge' ),
						'body'         => __( "Your product '{product_name}' has been submitted and is awaiting admin approval.", 'app-bridge' ),
					],
					[
						'id'           => 'product_approved',
						'label'        => __( 'Approved', 'app-bridge' ),
						'channel'      => 'product',
						'screen_route' => 'vendor_product_details',
						'title'        => __( 'Product Approved', 'app-bridge' ),
						'body'         => __( "Your product '{product_name}' has been approved and is now live.", 'app-bridge' ),
					],
					[
						'id'           => 'product_rejected',
						'label'        => __( 'Rejected', 'app-bridge' ),
						'channel'      => 'product',
						'screen_route' => 'vendor_product_details',
						'title'        => __( 'Product Rejected', 'app-bridge' ),
						'body'         => __( "Your product '{product_name}' was not approved. Check the admin's feedback.", 'app-bridge' ),
					],
					[
						'id'           => 'product_low_stock',
						'label'        => __( 'Low Stock', 'app-bridge' ),
						'channel'      => 'alert_reminder',
						'screen_route' => 'vendor_product_details',
						'title'        => __( 'Low Stock Alert', 'app-bridge' ),
						'body'         => __( "Your product '{product_name}' has only {stock_count} items left in stock.", 'app-bridge' ),
					],
					[
						'id'           => 'product_out_of_stock',
						'label'        => __( 'Out of Stock', 'app-bridge' ),
						'channel'      => 'alert_reminder',
						'screen_route' => 'vendor_product_details',
						'title'        => __( 'Out of Stock', 'app-bridge' ),
						'body'         => __( "Your product '{product_name}' is now out of stock. Update your inventory.", 'app-bridge' ),
					],
				],
			],
			'store'    => [
				'label'       => __( 'Store', 'app-bridge' ),
				'description' => __( 'Store registration and moderation alerts.', 'app-bridge' ),
				'events'      => [
					[
						'id'           => 'store_approved',
						'label'        => __( 'Store Approved', 'app-bridge' ),
						'channel'      => 'store',
						'screen_route' => 'vendor_store_dashboard',
						'title'        => __( 'Your Store is Approved!', 'app-bridge' ),
						'body'         => __( "Congratulations! Your store '{store_name}' has been approved. Start adding products.", 'app-bridge' ),
					],
					[
						'id'           => 'store_rejected',
						'label'        => __( 'Store Rejected', 'app-bridge' ),
						'channel'      => 'store',
						'screen_route' => 'vendor_store_setup',
						'title'        => __( 'Store Registration Rejected', 'app-bridge' ),
						'body'         => __( 'Your store registration was not approved. Please review the requirements and reapply.', 'app-bridge' ),
					],
					[
						'id'           => 'store_suspended',
						'label'        => __( 'Store Suspended', 'app-bridge' ),
						'channel'      => 'important',
						'screen_route' => 'vendor_store_dashboard',
						'title'        => __( 'Store Suspended', 'app-bridge' ),
						'body'         => __( "Your store '{store_name}' has been suspended by the admin. Contact support for assistance.", 'app-bridge' ),
					],
				],
			],
			'review'   => [
				'label'       => __( 'Review', 'app-bridge' ),
				'description' => __( 'New reviews and moderation alerts for vendor products.', 'app-bridge' ),
				'events'      => [
					[
						'id'           => 'review_new',
						'label'        => __( 'New Review', 'app-bridge' ),
						'channel'      => 'general',
						'screen_route' => 'vendor_product_reviews',
						'title'        => __( 'New Product Review', 'app-bridge' ),
						'body'         => __( "A customer left a {rating}-star review on your product '{product_name}'.", 'app-bridge' ),
					],
					[
						'id'           => 'review_pending_approval',
						'label'        => __( 'Pending Moderation', 'app-bridge' ),
						'channel'      => 'alert_reminder',
						'screen_route' => 'vendor_product_reviews',
						'title'        => __( 'Review Pending Moderation', 'app-bridge' ),
						'body'         => __( "A new review on '{product_name}' is awaiting admin moderation.", 'app-bridge' ),
					],
					[
						'id'           => 'store_review_new',
						'label'        => __( 'New Store Review', 'app-bridge' ),
						'channel'      => 'general',
						'screen_route' => 'vendor_store_reviews',
						'title'        => __( 'New Store Review', 'app-bridge' ),
						'body'         => __( 'A customer left a {rating}-star review on your store.', 'app-bridge' ),
					],
				],
			],
			'support'  => [
				'label'       => __( 'Support / Chat', 'app-bridge' ),
				'description' => __( 'Customer messages and support tickets sent to the vendor.', 'app-bridge' ),
				'events'      => [
					[
						'id'           => 'support_new_message',
						'label'        => __( 'New Message', 'app-bridge' ),
						'channel'      => 'chat',
						'screen_route' => 'vendor_support_chat',
						'title'        => __( 'New Message from Customer', 'app-bridge' ),
						'body'         => __( 'You have a new support message from a customer regarding order #{order_number}.', 'app-bridge' ),
					],
					[
						'id'           => 'support_ticket_opened',
						'label'        => __( 'Ticket Opened', 'app-bridge' ),
						'channel'      => 'chat',
						'screen_route' => 'vendor_support_ticket_details',
						'title'        => __( 'New Support Ticket', 'app-bridge' ),
						'body'         => __( 'A customer has opened a support ticket for order #{order_number}. Please respond promptly.', 'app-bridge' ),
					],
				],
			],
			'account'  => [
				'label'       => __( 'Account', 'app-bridge' ),
				'description' => __( 'Account creation and security alerts for vendors.', 'app-bridge' ),
				'events'      => [
					[
						'id'           => 'account_registered',
						'label'        => __( 'Account Registered', 'app-bridge' ),
						'channel'      => 'general',
						'screen_route' => 'vendor_store_setup',
						'title'        => __( 'Account Created', 'app-bridge' ),
						'body'         => __( 'Your vendor account has been created. Complete your store setup to start selling.', 'app-bridge' ),
					],
					[
						'id'           => 'account_password_changed',
						'label'        => __( 'Password Changed', 'app-bridge' ),
						'channel'      => 'important',
						'screen_route' => 'account_security',
						'title'        => __( 'Password Changed', 'app-bridge' ),
						'body'         => __( "Your account password was recently changed. If this wasn't you, contact support immediately.", 'app-bridge' ),
					],
				],
			],
		];
	}
}
