<?php

namespace KupShop\GraphQLBundle\ApiAdmin\Types;

use TheCodingMachine\GraphQLite\Annotations\Field;
use TheCodingMachine\GraphQLite\Annotations\Type;

/**
 * @Type()
 */
class Discount
{
    public $discount;

    public function __construct(array $discount)
    {
        $this->discount = $discount;
    }

    /**
     * @Field()
     */
    public function getDiscount(): string
    {
        return json_encode($this->discount);
    }

    public function getAmount()
    {
        return $this->discount['amount'];
    }

    public function getType()
    {
        return $this->discount['type'];
    }
}
