<commit_before><?php
/**
 * @author @jenschude <<EMAIL>>
 */

namespace Commercetools\Core\Model\Common;

use Commercetools\Core\Model\CustomerGroup\CustomerGroupReference;
use Commercetools\Core\Model\Channel\ChannelReference;
use Commercetools\Core\Model\CustomField\CustomFieldObject;
use DateTime;

/**
 * @package Commercetools\Core\Model\Common
 * @link https://docs.commercetools.com/http-api-projects-products.html#pricedraft
 * @method Money getValue()
 * @method PriceDraft setValue(Money $value = null)
 * @method string getCountry()
 * @method PriceDraft setCountry(string $country = null)
 * @method CustomerGroupReference getCustomerGroup()
 * @method PriceDraft setCustomerGroup(CustomerGroupReference $customerGroup = null)
 * @method ChannelReference getChannel()
 * @method PriceDraft setChannel(ChannelReference $channel = null)
 * @method DateTimeDecorator getValidFrom()
 * @method PriceDraft setValidFrom(DateTime $validFrom = null)
 * @method DateTimeDecorator getValidUntil()
 * @method PriceDraft setValidUntil(DateTime $validUntil = null)
 * @method CustomFieldObject getCustom()
 * @method PriceDraft setCustom(CustomFieldObject $custom = null)
 * @method PriceTierCollection getTiers()
 * @method PriceDraft setTiers(PriceTierCollection $tiers = null)
 */
class PriceDraft extends JsonObject
{
    const VALUE = 'value';
    const COUNTRY = 'country';
    const CUSTOMER_GROUP = 'customerGroup';
    const CHANNEL = 'channel';
    const VALID_FROM = 'validFrom';
    const VALID_UNTIL = 'validUntil';
    const DISCOUNTED = 'discounted';
    const CUSTOM = 'custom';
    const TIERS = 'tiers';

    public function fieldDefinitions()
    {
        return [
            static::VALUE => [self::TYPE => Money::class],
            static::COUNTRY => [self::TYPE => 'string'],
            static::CUSTOMER_GROUP => [self::TYPE => CustomerGroupReference::class],
            static::CHANNEL => [self::TYPE => ChannelReference::class],
            static::VALID_FROM => [
                self::TYPE => DateTime::class,
                self::DECORATOR => DateTimeDecorator::class
            ],
            static::VALID_UNTIL => [
                self::TYPE => DateTime::class,
                self::DECORATOR => DateTimeDecorator::class
            ],
            static::CUSTOM => [static::TYPE => CustomFieldObject::class],
            static::TIERS => [static::TYPE => PriceTierCollection::class]
        ];
    }

    /**
     * @param Money $money
     * @param Context|callable $context
     * @return PriceDraft
     */
    public static function ofMoney(Money $money, $context = null)
    {
        $price = static::of($context);
        return $price->setValue($money);
    }
<commit_msg>feat(Product): add discounted field to PriceDraft<commit_after><?php
/**
 * @author @jenschude <<EMAIL>>
 */

namespace Commercetools\Core\Model\Common;

use Commercetools\Core\Model\CustomerGroup\CustomerGroupReference;
use Commercetools\Core\Model\Channel\ChannelReference;
use Commercetools\Core\Model\CustomField\CustomFieldObject;
use DateTime;

/**
 * @package Commercetools\Core\Model\Common
 * @link https://docs.commercetools.com/http-api-projects-products.html#pricedraft
 * @method Money getValue()
 * @method PriceDraft setValue(Money $value = null)
 * @method string getCountry()
 * @method PriceDraft setCountry(string $country = null)
 * @method CustomerGroupReference getCustomerGroup()
 * @method PriceDraft setCustomerGroup(CustomerGroupReference $customerGroup = null)
 * @method ChannelReference getChannel()
 * @method PriceDraft setChannel(ChannelReference $channel = null)
 * @method DateTimeDecorator getValidFrom()
 * @method PriceDraft setValidFrom(DateTime $validFrom = null)
 * @method DateTimeDecorator getValidUntil()
 * @method PriceDraft setValidUntil(DateTime $validUntil = null)
 * @method CustomFieldObject getCustom()
 * @method PriceDraft setCustom(CustomFieldObject $custom = null)
 * @method PriceTierCollection getTiers()
 * @method PriceDraft setTiers(PriceTierCollection $tiers = null)
 * @method DiscountedPrice getDiscounted()
 * @method PriceDraft setDiscounted(DiscountedPrice $discounted = null)
 */
class PriceDraft extends JsonObject
{
    const VALUE = 'value';
    const COUNTRY = 'country';
    const CUSTOMER_GROUP = 'customerGroup';
    const CHANNEL = 'channel';
    const VALID_FROM = 'validFrom';
    const VALID_UNTIL = 'validUntil';
    const DISCOUNTED = 'discounted';
    const CUSTOM = 'custom';
    const TIERS = 'tiers';

    public function fieldDefinitions()
    {
        return [
            static::VALUE => [self::TYPE => Money::class],
            static::COUNTRY => [self::TYPE => 'string'],
            static::CUSTOMER_GROUP => [self::TYPE => CustomerGroupReference::class],
            static::CHANNEL => [self::TYPE => ChannelReference::class],
            static::VALID_FROM => [
                self::TYPE => DateTime::class,
                self::DECORATOR => DateTimeDecorator::class
            ],
            static::VALID_UNTIL => [
                self::TYPE => DateTime::class,
                self::DECORATOR => DateTimeDecorator::class
            ],
            static::CUSTOM => [static::TYPE => CustomFieldObject::class],
            static::TIERS => [static::TYPE => PriceTierCollection::class],
            static::DISCOUNTED => [static::TYPE => DiscountedPrice::class],
        ];
    }

    /**
     * @param Money $money
     * @param Context|callable $context
     * @return PriceDraft
     */
    public static function ofMoney(Money $money, $context = null)
    {
        $price = static::of($context);
        return $price->setValue($money);
    }

{'fraction_non_alphanumeric': 0.12402964008468596, 'fraction_numerical': 0.0, 'mean_word_length': 3.586569579288026, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 47, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2254458', 'n_tokens_mistral': 1622, 'n_tokens_neox': 1594, 'n_words': 344}