<commit_before><?php
/**
 * This file is part of the CalendArt package
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
 *
 * @copyright Wisembly
 * @license   http://www.opensource.org/licenses/MIT-License MIT License
 */

namespace CalendArt\Adapter\Google\Event;

use Datetime;

use Doctrine\Common\Collections\Collection,
    Doctrine\Common\Collections\ArrayCollection;

use CalendArt\Adapter\Google\User,
    CalendArt\Adapter\Google\AbstractEvent,
    CalendArt\Adapter\Google\EventParticipation;

/**
 * Base event class for google events
 *
 * The one that are complete, you know.
 *
 * @author <NAME> <<EMAIL>>
 */
class BasicEvent extends AbstractEvent
{
    const VISIBILITY_DEFAULT      = 'default';
    const VISIBILITY_PUBLIC       = 'public';
    const VISIBILITY_PRIVATE      = 'private';
    const VISIBILITY_CONFIDENTIAL = 'confidential';

    /** @var Datetime */
    private $createdAt;

    /** @var Datetime */
    private $updatedAt;

    /** @var string Where the event is supposed to happen */
    public $location;

    /** @var string Event's visibility */
    private $visibility = self::VISIBILITY_DEFAULT;

    /** @var boolean Can this event overlap other events on the same time frame ? */
    public $overlap = false;

    /** @return Datetime */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /** @return Datetime */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
    }

    public function getEtag()
    {
        return $this->etag;
    }

    public function getVisibility()
    {
        return $this->visibility;
    }

    public function setVisibility($visibility)
    {
        if (!in_array($visibility, static::getVisibilties())) {
            throw new InvalidArgumentException(sprintf('Wrong visibility ; had "%s", expected one of ["%s"]', $visibility, implode('", "', static::getVisibilties())));
        }

        $this->visibility = $visibility;

        return $this;
    }

    protected static function getVisibilties()
    {
        return [static::VISIBILITY_DEFAULT, static::VISIBILITY_PUBLIC, static::VISIBILITY_PRIVATE, static::VISIBILITY_CONFIDENTIAL];
    }

    /**
     * Determine if this event can be overlapped with other events
     *
     * @return Boolean
     */
    public function hasOverlap()
    {
        return true === $this->overlap;
    }

    public function setOverlap($overlap)
    {
        $this->overlap = (bool) $overlap;

        return $this;
    }

    /**
     * Build the participant collection from a set of User
     *
     * @param array Participant data
     *<commit_msg>[Google] Rename overlap property to stackable<commit_after><?php
/**
 * This file is part of the CalendArt package
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
 *
 * @copyright Wisembly
 * @license   http://www.opensource.org/licenses/MIT-License MIT License
 */

namespace CalendArt\Adapter\Google\Event;

use Datetime;

use Doctrine\Common\Collections\Collection,
    Doctrine\Common\Collections\ArrayCollection;

use CalendArt\Adapter\Google\User,
    CalendArt\Adapter\Google\AbstractEvent,
    CalendArt\Adapter\Google\EventParticipation;

/**
 * Base event class for google events
 *
 * The one that are complete, you know.
 *
 * @author <NAME> <<EMAIL>>
 */
class BasicEvent extends AbstractEvent
{
    const VISIBILITY_DEFAULT      = 'default';
    const VISIBILITY_PUBLIC       = 'public';
    const VISIBILITY_PRIVATE      = 'private';
    const VISIBILITY_CONFIDENTIAL = 'confidential';

    /** @var Datetime */
    private $createdAt;

    /** @var Datetime */
    private $updatedAt;

    /** @var string Where the event is supposed to happen */
    public $location;

    /** @var boolean Can this event be stacked with other events on the same time frame ? */
    private $stackable = false;

    /** @var string Event's visibility */
    private $visibility = self::VISIBILITY_DEFAULT;

    /** @return Datetime */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /** @return Datetime */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
    }

    public function getEtag()
    {
        return $this->etag;
    }

    public function getVisibility()
    {
        return $this->visibility;
    }

    public function setVisibility($visibility)
    {
        if (!in_array($visibility, static::getVisibilties())) {
            throw new InvalidArgumentException(sprintf('Wrong visibility ; had "%s", expected one of ["%s"]', $visibility, implode('", "', static::getVisibilties())));
        }

        $this->visibility = $visibility;

        return $this;
    }

    protected static function getVisibilties()
    {
        return [static::VISIBILITY_DEFAULT, static::VISIBILITY_PUBLIC, static::VISIBILITY_PRIVATE, static::VISIBILITY_CONFIDENTIAL];
    }

    /**
     * Determine if this event can be stacked with other events
     *
     * @return Boolean
     */
    public function isStackable()
    {
        return true === $this->stackable;
    }

    public function setStackable($stackable)
    {
        $this->stackable = (bool) $stackable;

        return $this;
    }

    /**
     * Build the participant collection from a set of User
     *
     * @param array Participant data
     *
{'fraction_non_alphanumeric': 0.10954902318787657, 'fraction_numerical': 0.0, 'mean_word_length': 2.7779310344827586, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4318796', 'n_tokens_mistral': 1585, 'n_tokens_neox': 1506, 'n_words': 435}