<?php

namespace KupShop\GraphQLBundle\ApiShared\Types;

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

/**
 * @Type()
 */
class DateInterval
{
    private \DateTimeInterface $from;
    private \DateTimeInterface $to;

    public function __construct(\DateTimeInterface $from, \DateTimeInterface $to)
    {
        $this->from = $from;
        $this->to = $to;
    }

    /**
     * Od.
     *
     * @Field()
     */
    public function getFrom(): string
    {
        return $this->from->format('Y-m-d H:i:s');
    }

    /**
     * Do.
     *
     * @Field()
     */
    public function getTo(): string
    {
        return $this->to->format('Y-m-d H:i:s');
    }
}
