<?php
namespace RadiusTheme\RadiusBooking\Resources;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
use RadiusTheme\RadiusBooking\Abstracts\BaseResource;

/**
 * Api/Resources/CategoryResource.php
 * Category resource transformer
 *
 * @package RadiusTheme\RadiusBooking\Resources
 */
class CategoryResource extends BaseResource {

	/**
	 * Transform a Category model into an API-friendly array.
	 *
	 * @param object $category The Category model instance.
	 * @return array Transformed data.
	 */
	public function transform( $category ): array {
		return array(
			'id'           => $category->id,
			'name'         => $category->name,
			'status'       => $category->status,
			'order_number' => $category->order_number,
			'image_id'     => $category->image_id,
			'translations' => maybe_unserialize( $category->translations ),
			'created_at'   => $category->created_at,
			'updated_at'   => $category->updated_at,
		);
	}
}
