<?php
/**
 * @package     CMGiftCard
 * @subpackage  com_cmgiftcard
 * @copyright   Copyright (C) 2016-2024 CMExension
 * @license     GNU General Public License version 2 or later
 */

defined('_JEXEC') or die;

use Joomla\CMS\MVC\Model\BaseDatabaseModel;

/**
 * Model for gift card design.
 *
 * @package     CMGiftCard
 * @subpackage  com_cmgiftcard
 * @since       1.0.0
 */
class CMGiftCardModelDesign extends BaseDatabaseModel
{
	/**
	 * Method to get a design.
	 *
	 * @params  integer  $designId  Design's ID.
	 *
	 * @return  mixed
	 *
	 * @since   1.0.0
	 */
	public function getDesign($designId)
	{
		$db = $this->getDbo();
		$query = $db->getQuery(true)
			->select($db->qn(array('id', 'title', 'card_type', 'image', 'published', 'ordering')))
			->from($db->qn('#__cmgiftcard_designs'))
			->where($db->qn('id') . ' = ' . $db->q((int) $designId))
			->where($db->qn('published') . ' = ' . $db->q(1));

		return $db->setQuery($query)->loadObject();
	}
}
