<?php

namespace Hydrators;

use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
use Doctrine\ODM\MongoDB\Hydrator\HydratorInterface;
use Doctrine\ODM\MongoDB\Query\Query;
use Doctrine\ODM\MongoDB\UnitOfWork;

/**
 * THIS CLASS WAS GENERATED BY THE DOCTRINE ODM. DO NOT EDIT THIS FILE.
 */
class OfficeBrainBundleQueueBundleDocumentDistributorQueueHydrator implements HydratorInterface
{
    private $dm;
    private $unitOfWork;
    private $class;

    public function __construct(DocumentManager $dm, UnitOfWork $uow, ClassMetadata $class)
    {
        $this->dm = $dm;
        $this->unitOfWork = $uow;
        $this->class = $class;
    }

    public function hydrate($document, $data, array $hints = array())
    {
        $hydratedData = array();

        /** @Field(type="id") */
        if (isset($data['_id']) || (! empty($this->class->fieldMappings['id']['nullable']) && array_key_exists('_id', $data))) {
            $value = $data['_id'];
            if ($value !== null) {
                $typeIdentifier = $this->class->fieldMappings['id']['type'];
                $return = $value instanceof \MongoId ? (string) $value : $value;
            } else {
                $return = null;
            }
            $this->class->reflFields['id']->setValue($document, $return);
            $hydratedData['id'] = $return;
        }

        /** @Field(type="string") */
        if (isset($data['status']) || (! empty($this->class->fieldMappings['status']['nullable']) && array_key_exists('status', $data))) {
            $value = $data['status'];
            if ($value !== null) {
                $typeIdentifier = $this->class->fieldMappings['status']['type'];
                $return = (string) $value;
            } else {
                $return = null;
            }
            $this->class->reflFields['status']->setValue($document, $return);
            $hydratedData['status'] = $return;
        }

        /** @Field(type="string") */
        if (isset($data['message']) || (! empty($this->class->fieldMappings['message']['nullable']) && array_key_exists('message', $data))) {
            $value = $data['message'];
            if ($value !== null) {
                $typeIdentifier = $this->class->fieldMappings['message']['type'];
                $return = (string) $value;
            } else {
                $return = null;
            }
            $this->class->reflFields['message']->setValue($document, $return);
            $hydratedData['message'] = $return;
        }

        /** @Field(type="int") */
        if (isset($data['supplierId']) || (! empty($this->class->fieldMappings['supplierId']['nullable']) && array_key_exists('supplierId', $data))) {
            $value = $data['supplierId'];
            if ($value !== null) {
                $typeIdentifier = $this->class->fieldMappings['supplierId']['type'];
                $return = (int) $value;
            } else {
                $return = null;
            }
            $this->class->reflFields['supplierId']->setValue($document, $return);
            $hydratedData['supplierId'] = $return;
        }

        /** @Field(type="int") */
        if (isset($data['distributorId']) || (! empty($this->class->fieldMappings['distributorId']['nullable']) && array_key_exists('distributorId', $data))) {
            $value = $data['distributorId'];
            if ($value !== null) {
                $typeIdentifier = $this->class->fieldMappings['distributorId']['type'];
                $return = (int) $value;
            } else {
                $return = null;
            }
            $this->class->reflFields['distributorId']->setValue($document, $return);
            $hydratedData['distributorId'] = $return;
        }

        /** @Field(type="string") */
        if (isset($data['name']) || (! empty($this->class->fieldMappings['name']['nullable']) && array_key_exists('name', $data))) {
            $value = $data['name'];
            if ($value !== null) {
                $typeIdentifier = $this->class->fieldMappings['name']['type'];
                $return = (string) $value;
            } else {
                $return = null;
            }
            $this->class->reflFields['name']->setValue($document, $return);
            $hydratedData['name'] = $return;
        }

        /** @Field(type="string") */
        if (isset($data['objectName']) || (! empty($this->class->fieldMappings['objectName']['nullable']) && array_key_exists('objectName', $data))) {
            $value = $data['objectName'];
            if ($value !== null) {
                $typeIdentifier = $this->class->fieldMappings['objectName']['type'];
                $return = (string) $value;
            } else {
                $return = null;
            }
            $this->class->reflFields['objectName']->setValue($document, $return);
            $hydratedData['objectName'] = $return;
        }

        /** @Field(type="string") */
        if (isset($data['action']) || (! empty($this->class->fieldMappings['action']['nullable']) && array_key_exists('action', $data))) {
            $value = $data['action'];
            if ($value !== null) {
                $typeIdentifier = $this->class->fieldMappings['action']['type'];
                $return = (string) $value;
            } else {
                $return = null;
            }
            $this->class->reflFields['action']->setValue($document, $return);
            $hydratedData['action'] = $return;
        }

        /** @Field(type="hash") */
        if (isset($data['args']) || (! empty($this->class->fieldMappings['args']['nullable']) && array_key_exists('args', $data))) {
            $value = $data['args'];
            if ($value !== null) {
                $typeIdentifier = $this->class->fieldMappings['args']['type'];
                $return = $value;
            } else {
                $return = null;
            }
            $this->class->reflFields['args']->setValue($document, $return);
            $hydratedData['args'] = $return;
        }

        /** @Field(type="int") */
        if (isset($data['priority']) || (! empty($this->class->fieldMappings['priority']['nullable']) && array_key_exists('priority', $data))) {
            $value = $data['priority'];
            if ($value !== null) {
                $typeIdentifier = $this->class->fieldMappings['priority']['type'];
                $return = (int) $value;
            } else {
                $return = null;
            }
            $this->class->reflFields['priority']->setValue($document, $return);
            $hydratedData['priority'] = $return;
        }

        /** @Field(type="date") */
        if (isset($data['started'])) {
            $value = $data['started'];
            if ($value === null) { $return = null; } else { $return = \Doctrine\ODM\MongoDB\Types\DateType::getDateTime($value); }
            $this->class->reflFields['started']->setValue($document, clone $return);
            $hydratedData['started'] = $return;
        }

        /** @Field(type="date") */
        if (isset($data['finished'])) {
            $value = $data['finished'];
            if ($value === null) { $return = null; } else { $return = \Doctrine\ODM\MongoDB\Types\DateType::getDateTime($value); }
            $this->class->reflFields['finished']->setValue($document, clone $return);
            $hydratedData['finished'] = $return;
        }

        /** @Field(type="date") */
        if (isset($data['createdAt'])) {
            $value = $data['createdAt'];
            if ($value === null) { $return = null; } else { $return = \Doctrine\ODM\MongoDB\Types\DateType::getDateTime($value); }
            $this->class->reflFields['createdAt']->setValue($document, clone $return);
            $hydratedData['createdAt'] = $return;
        }

        /** @Field(type="date") */
        if (isset($data['updatedAt'])) {
            $value = $data['updatedAt'];
            if ($value === null) { $return = null; } else { $return = \Doctrine\ODM\MongoDB\Types\DateType::getDateTime($value); }
            $this->class->reflFields['updatedAt']->setValue($document, clone $return);
            $hydratedData['updatedAt'] = $return;
        }
        return $hydratedData;
    }
}