<?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 OfficeBrainBundleQueueBundleDocumentProductQueueHydrator 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['from']) || (! empty($this->class->fieldMappings['from']['nullable']) && array_key_exists('from', $data))) {
            $value = $data['from'];
            if ($value !== null) {
                $typeIdentifier = $this->class->fieldMappings['from']['type'];
                $return = (string) $value;
            } else {
                $return = null;
            }
            $this->class->reflFields['from']->setValue($document, $return);
            $hydratedData['from'] = $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['culture']) || (! empty($this->class->fieldMappings['culture']['nullable']) && array_key_exists('culture', $data))) {
            $value = $data['culture'];
            if ($value !== null) {
                $typeIdentifier = $this->class->fieldMappings['culture']['type'];
                $return = (string) $value;
            } else {
                $return = null;
            }
            $this->class->reflFields['culture']->setValue($document, $return);
            $hydratedData['culture'] = $return;
        }

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

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

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

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