src/Entity/Property.php line 200

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use Symfony\Component\Security\Core\User\UserInterface;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. use Symfony\Component\Serializer\Annotation\SerializedName;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\RangeFilter;
  9. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  10. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  11. use ApiPlatform\Core\Annotation\ApiResource;
  12. use Doctrine\Common\Collections\ArrayCollection;
  13. use Doctrine\Common\Collections\Collection;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use App\Domain\PropertyMatching\Adapters\Gateway\Doctrine\PropertyMatchingEntity;
  16. use App\Controller\Manager\Property\UnderCompromisePropertyController;
  17. use App\Controller\Manager\Property\SoldByMilkiyaPropertyController;
  18. use App\Controller\Manager\Property\InProgressPropertyController;
  19. use App\Controller\Manager\Property\InvalidPropertyController;
  20. use App\Controller\Manager\Property\PendingPropertyController;
  21. use App\Controller\Agent\Property\TechnicalDataSheetController;
  22. use App\Entity\Reference\ReferencePropertyConstructionType;
  23. use App\Entity\Reference\PropertyDiffusionModeReference;
  24. use App\Entity\Reference\ReferencePropertyContractType;
  25. use App\Entity\Reference\ReferencePropertyDestination;
  26. use App\Entity\Reference\ReferencePropertyOrientation;
  27. use App\Entity\Reference\ReferencePropertyServiceType;
  28. use App\Entity\Reference\ReferencePropertyLandType;
  29. use App\Entity\Reference\ReferencePropertyDomain;
  30. use App\Entity\Reference\ReferencePropertyStatus;
  31. use App\Entity\Reference\ReferencePropertyState;
  32. use App\Entity\Reference\ReferencePropertyType;
  33. use App\Validator\Constraints\UniqueProperty;
  34. use App\Validator\Constraints\AreaProperty;
  35. use App\Repository\PropertyRepository;
  36. use App\Filter\NullablePropertyMatchingFilter;
  37. use App\Traits\TimeStampTrait;
  38. use DateTimeInterface;
  39. use App\Filter\ValidMandateAdditionalPropertyFilter;
  40. use App\EventListener\PropertyListener;
  41. use App\Controller\Manager\Property\ArchivePropertyController;
  42. use App\Filter\NumberOfRoomFilter;
  43. use App\Filter\CustomBooleanFilter;
  44. use App\Filter\TypeMandateInBiensFilter;
  45. use App\Filter\RecommendedPropertyFilter;
  46. /**
  47.  * @ApiResource(
  48.  *     attributes={
  49.  *          "pagination_client_enabled"=true,
  50.  *          "pagination_items_per_page"=10,
  51.  *          "order"={"id":"DESC"},
  52.  *          "formats"={"jsonld", "json", "html", "jsonhal", "csv"={"text/csv"} }
  53.  *     },
  54.  *     normalizationContext={"groups"={"property:read"}, "swagger_definition_name"="Read"},
  55.  *     denormalizationContext={
  56.  *          "groups"={"property:write"},
  57.  *          "swagger_definition_name"="Write",
  58.  *          "skip_null_values" = true
  59.  *     },
  60.  *     itemOperations={
  61.  *          "get" = { "security" = "is_granted('ROLE_MANAGER') or is_granted('PROPERTY_DETAILS', object)"},
  62.  *          "put" = {
  63.  *              "security"="is_granted('PROPERTY_EDIT', object)",
  64.  *              "denormalization_context"={"groups"={"property:put"}},
  65.  *              },
  66.  *          "invalid_property"={
  67.  *              "denormalization_context"={"groups"={"property:invalid"}},
  68.  *              "access_control"="is_granted('ROLE_MANAGER')",
  69.  *              "method"="PATCH",
  70.  *              "path"="/property/{id}/invalid",
  71.  *              "controller"=InvalidPropertyController::class,
  72.  *              "read"=true,
  73.  *              "write"=false,
  74.  *          },
  75.  *          "download_technical_data_sheet"={
  76.  *              "access_control"="is_granted('ROLE_MANAGER') or is_granted('ROLE_AGENT')",
  77.  *              "method"="GET",
  78.  *              "path"="/property/{id}/technical_data_sheet",
  79.  *              "controller"=TechnicalDataSheetController::class,
  80.  *              "read"=true,
  81.  *              "write"=false,
  82.  *          },
  83.  *          "in_progress_property"={
  84.  *              "denormalization_context"={"groups"={"property:in_progress"}},
  85.  *              "access_control"="is_granted('ROLE_MANAGER')",
  86.  *              "method"="PATCH",
  87.  *              "path"="/property/{id}/in_progress",
  88.  *              "controller"=InProgressPropertyController::class,
  89.  *              "read"=true,
  90.  *              "write"=false,
  91.  *          },
  92.  *        "pending_property"={
  93.  *              "denormalization_context"={"groups"={"property:in_progress"}},
  94.  *              "access_control"="is_granted('ROLE_MANAGER')",
  95.  *              "method"="PATCH",
  96.  *              "path"="/property/{id}/pending",
  97.  *              "controller"=PendingPropertyController::class,
  98.  *              "read"=true,
  99.  *              "write"=false,
  100.  *          },
  101.  *          "under_compromise_property"={
  102.  *              "denormalization_context"={"groups"={"property:under_compromise"}},
  103.  *              "access_control"="is_granted('ROLE_MANAGER')",
  104.  *              "method"="PATCH",
  105.  *              "path"="/property/{id}/under_compromise",
  106.  *              "controller"=UnderCompromisePropertyController::class,
  107.  *              "read"=true,
  108.  *              "write"=false,
  109.  *          },
  110.  *          "sold_by_milkiya_property"={
  111.  *              "denormalization_context"={"groups"={"property:sold_by_milkiya"}},
  112.  *              "access_control"="is_granted('ROLE_MANAGER')",
  113.  *              "method"="PATCH",
  114.  *              "path"="/property/{id}/sold_by_milkiya",
  115.  *              "controller"=SoldByMilkiyaPropertyController::class,
  116.  *              "read"=true,
  117.  *              "write"=false,
  118.  *          },
  119.  *          "archive_property"={
  120.  *              "denormalization_context"={"groups"={"property:property"}},
  121.  *              "access_control"="( (is_granted('ROLE_AGENT') and object.getcollaborator() === user) or
  122.                                     is_granted('ROLE_MANAGER') or is_granted('ROLE_IT') )",
  123.  *              "method"="PATCH",
  124.  *              "path"="/property/{id}/archive",
  125.  *              "controller"=ArchivePropertyController::class,
  126.  *              "read"=true,
  127.  *              "write"=false,
  128.  *          },
  129.  *     },
  130.  *     collectionOperations={
  131.  *          "get" = { "security" = "is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')"},
  132.  *         "post" = {
  133.  *             "security_post_denormalize" = "is_granted('POST', object)",
  134.  *          },
  135.  *         "milkiya_properties"={
  136.  *              "access_control"="is_granted('PUBLIC_ACCESS')",
  137.  *              "normalization_context"={"groups"={"milkiya:read"}},
  138.  *              "method"="GET",
  139.  *              "path"="/internal/properties",
  140.  *              "pagination_enabled" = false
  141.  *          },
  142.  *     },
  143.  *     subresourceOperations={
  144.  *          "api_mandates_additional_properties_get_subresource"={
  145.  *              "method"="GET",
  146.  *              "security"="is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')"
  147.  *          }
  148.  *      }
  149.  * )
  150.  * @ApiFilter(OrderFilter::class, properties={
  151.  *     "id",
  152.  *     "maximumPrice",
  153.  *     "minimalPrice",
  154.  *     "minimalArea",
  155.  *     "maximalArea",
  156.  *     "roomsNumber",
  157.  *     "constructionYear"
  158.  *  } , arguments= {"orderParameterName" : "order"})
  159.  *
  160.  * @ApiFilter(SearchFilter::class, properties={
  161.  *     "id": "exact",
  162.  *     "prescriber": "exact",
  163.  *     "propertyReferenceType" : "exact",
  164.  *     "collaborator.id" : "exact",
  165.  *     "referenceServiceType.code":"exact",
  166.  *     "referencePropertyDestination.code":"exact",
  167.  *  *  "referencePropertyStatus.code":"exact",
  168.  *     "referenceServiceType":"exact",
  169.  *     "referencePropertyDomain":"exact",
  170.  *     "referencePropertyDestination":"exact",
  171.  *     "propertyAddress.city": "exact",
  172.  *     "propertyAddress.neighborhood": "exact",
  173.  *     "referencePropertyStatus" : "exact",
  174.  *     "referencePropertyType" : "exact",
  175.  *     "referencePropertyContractType" : "exact",
  176.  *     "contact": "exact",
  177.  *     "referencePropertyDiffusionMode" : "exact"
  178.  *
  179.  * })
  180.  * @ApiFilter(RangeFilter::class, properties={
  181.  *     "maximalArea",
  182.  *     "maximumPrice"
  183.  * })
  184.  * @ApiFilter(TypeMandateInBiensFilter::class, properties={"mandates"})
  185.  * @ApiFilter(CustomBooleanFilter::class, properties={"isFurnished", "hasParkCar", "hasElevator"})
  186.  * @ApiFilter(NullablePropertyMatchingFilter::class, properties={"matchingEntity", "matchingEntity.deletedAt"})
  187.  * @ApiFilter(ValidMandateAdditionalPropertyFilter::class, properties={"additionalProperties"})
  188.  * @ApiFilter(NumberOfRoomFilter::class,properties={"numberOfRooms"})
  189.  * @ApiFilter (RecommendedPropertyFilter::class,properties={"recommendation"})
  190.  * @ORM\Entity(repositoryClass=PropertyRepository::class)
  191.  * @ORM\EntityListeners({PropertyListener::class})
  192.  * @ORM\HasLifecycleCallbacks()
  193.  *
  194.  * @UniqueProperty()
  195.  * @AreaProperty()
  196.  */
  197. class Property implements Loggable
  198. {
  199.     use TimeStampTrait;
  200.     public const STATUS_IN_PROGRESS 'reference.status.in_progress';
  201.     public const MODE_REFERENCE_DIFFUSION_SAROUTY 'SAROUTY';
  202.     public const MODE_REFERENCE_DIFFUSION_AVITO 'AVITO';
  203.     public const MODE_REFERENCE_DIFFUSION_YIELDIS 'YIELDIS';
  204.     public const MODE_REFERENCE_DIFFUSION_MUBAWAB 'MUBAWAB';
  205.     public const MODE_REFERENCE_DIFFUSION_AGENZ 'AGENZ';
  206.     public const MODE_REFERENCE_DIFFUSION_MULTILIST 'MULTILIST';
  207.     public const REFERENCE_STATUS_IN_PROGRESS '0';
  208.     /**
  209.      * @ORM\Id
  210.      * @ORM\GeneratedValue
  211.      * @ORM\Column(type="integer")
  212.      *
  213.      * @Groups({
  214.      *    "property:read",
  215.      *    "mandate:read",
  216.      *    "transaction-item:read",
  217.      *    "business-indication:item:read",
  218.      *    "contact:read",
  219.      *    "property-visit:read"
  220.      * })
  221.      */
  222.     private $id;
  223.     /**
  224.      * @ORM\Column(type="float", nullable=true)
  225.      *
  226.      * @Groups({
  227.      *    "property:read","property:write","property:put",
  228.      *    "mandate:read",
  229.      *    "transaction-item:read",
  230.      *    "business-indication:item:read",
  231.      *    "milkiya:read",
  232.      *    "contact:read",
  233.      *    "contact:read",
  234.      *    "property-visit:read",
  235.      * })
  236.      *
  237.      */
  238.     private ?float $maximalArea;
  239.     /**
  240.      * @ORM\Column(type="float", nullable=true)
  241.      *
  242.      * @Groups({
  243.      *    "property:read","property:write","property:put",
  244.      *    "mandate:read",
  245.      *    "transaction-item:read",
  246.      *    "milkiya:read",
  247.      *    "business-indication:item:read",
  248.      * })
  249.      *
  250.      */
  251.     private ?float $minimalArea;
  252.     /**
  253.      * @ORM\Column(type="float", nullable=true)
  254.      *
  255.      * @Groups({
  256.      *    "property:read","property:write","property:put",
  257.      *    "mandate:read",
  258.      *    "transaction-item:read",
  259.      *    "milkiya:read",
  260.      *    "business-indication:item:read",
  261.      * })
  262.      *
  263.      */
  264.     private ?float $minimalPrice;
  265.     /**
  266.      * @ORM\Column(type="float",nullable=false)
  267.      *
  268.      * @Groups({
  269.      *    "property:read","property:write","property:put",
  270.      *    "mandate:read",
  271.      *    "transaction-item:read",
  272.      *    "milkiya:read",
  273.      *    "business-indication:item:read",
  274.      *    "contact:read",
  275.      *    "property-visit:read"
  276.      * })
  277.      *
  278.      * @Assert\GreaterThanOrEqual(
  279.      *     propertyPath="minimalPrice",
  280.      *     message="max price must be greater than min price."
  281.      * )
  282.      *
  283.      */
  284.     private ?float $maximumPrice;
  285.     /**
  286.      * @deprecated
  287.      * @ORM\Column(type="integer",nullable=true)
  288.      *
  289.      * @Groups({
  290.      *    "property:read","property:write","property:put",
  291.      *    "mandate:read",
  292.      *    "transaction-item:read",
  293.      *    "milkiya:read",
  294.      *    "business-indication:item:read",
  295.      * })
  296.      * Nombre des pieces
  297.      */
  298.     private ?int $roomsNumber;
  299.     /**
  300.      * @ORM\Column(type="boolean",nullable=true)
  301.      *
  302.      * @Groups({
  303.      *    "property:read","property:write","property:put",
  304.      *    "mandate:read",
  305.      *    "transaction-item:read",
  306.      *    "milkiya:read",
  307.      *    "business-indication:item:read",
  308.      * })
  309.      *
  310.      */
  311.     private ?bool $isAvailable;
  312.     /**
  313.      * @ORM\Column(type="date_immutable",nullable=true)
  314.      *
  315.      * @Groups({
  316.      *    "property:read","property:write","property:put",
  317.      *    "mandate:read",
  318.      *    "transaction-item:read",
  319.      *    "business-indication:item:read",
  320.      *    "milkiya:read"
  321.      * })
  322.      */
  323.     private ?DateTimeInterface $dateAvailability;
  324.     /**
  325.      * @ORM\Column(type="date_immutable",nullable=true)
  326.      *
  327.      * @Groups({
  328.      *    "property:read","property:write","property:put",
  329.      *    "mandate:read",
  330.      *    "transaction-item:read",
  331.      *    "milkiya:read",
  332.      *    "business-indication:item:read",
  333.      * })
  334.      *
  335.      */
  336.     private ?DateTimeInterface $constructionYear;
  337.     /**
  338.      * @ORM\Column(type="integer",nullable=true)
  339.      *
  340.      * @Groups({
  341.      *    "property:read","property:write","property:put",
  342.      *    "mandate:read",
  343.      *    "transaction-item:read",
  344.      *    "milkiya:read",
  345.      *    "business-indication:item:read",
  346.      * })
  347.      *
  348.      */
  349.     private ?int $floorsNumber;
  350.     /**
  351.      * @ORM\Column(type="boolean")
  352.      *
  353.      * @Groups({
  354.      *    "property:read","property:write","property:put",
  355.      *    "mandate:read",
  356.      *    "transaction-item:read",
  357.      *    "milkiya:read"
  358.      * })
  359.      *
  360.      */
  361.     private ?bool $isFurnished false;
  362.     /**
  363.      * @ORM\Column(type="boolean", nullable=true)
  364.      *
  365.      * @Groups({
  366.      *    "property:read","property:write","property:put",
  367.      *    "mandate:read",
  368.      *    "transaction-item:read",
  369.      *     "milkiya:read"
  370.      * })
  371.      *
  372.      */
  373.     private ?bool $hasGuardian;
  374.     /**
  375.      * @ORM\Column(type="boolean", nullable=true)
  376.      *
  377.      * @Groups({
  378.      *    "property:read","property:write","property:put",
  379.      *    "mandate:read",
  380.      *    "transaction-item:read",
  381.      *     "milkiya:read"
  382.      * })
  383.      */
  384.     private ?bool $hasIntercom;
  385.     /**
  386.      * @ORM\Column(type="boolean", nullable=true)
  387.      *
  388.      * @Groups({
  389.      *    "property:read","property:write","property:put",
  390.      *    "mandate:read",
  391.      *    "transaction-item:read",
  392.      *    "milkiya:read"
  393.      * })
  394.      *
  395.      */
  396.     private ?bool $hasElevator;
  397.     /**
  398.      * @ORM\Column(type="boolean", nullable=true)
  399.      *
  400.      * @Groups({
  401.      *    "property:read","property:write","property:put",
  402.      *    "mandate:read",
  403.      *    "transaction-item:read",
  404.      *    "milkiya:read"
  405.      * })
  406.      */
  407.     private ?bool $hasTerrace;
  408.     /**
  409.      * @ORM\Column(type="boolean", nullable=true)
  410.      *
  411.      * @Groups({
  412.      *    "property:read","property:write","property:put",
  413.      *    "mandate:read",
  414.      *    "transaction-item:read",
  415.      *     "milkiya:read"
  416.      * })
  417.      *
  418.      */
  419.     private ?bool $hasBalcony;
  420.     /**
  421.      * @ORM\Column(type="boolean", nullable=true)
  422.      *
  423.      * @Groups({
  424.      *    "property:read","property:write","property:put",
  425.      *    "mandate:read",
  426.      *    "transaction-item:read",
  427.      *    "milkiya:read"
  428.      *
  429.      * })
  430.      *
  431.      */
  432.     private ?bool $hasGarage;
  433.     /**
  434.      * @ORM\Column(type="boolean", nullable=true)
  435.      *
  436.      * @Groups({
  437.      *    "property:read","property:write","property:put",
  438.      *    "mandate:read",
  439.      *    "transaction-item:read",
  440.      *    "milkiya:read"
  441.      * })
  442.      *
  443.      */
  444.     private ?bool $hasParkCar;
  445.     /**
  446.      * @ORM\Column(type="boolean", nullable=true)
  447.      *
  448.      * @Groups({
  449.      *    "property:read","property:write","property:put",
  450.      *    "mandate:read",
  451.      *    "transaction-item:read",
  452.      *    "milkiya:read"
  453.      * })
  454.      *
  455.      */
  456.     private ?bool $hasParkCarOutside;
  457.     /**
  458.      * @ORM\Column(type="boolean", nullable=true)
  459.      *
  460.      * @Groups({
  461.      *    "property:read","property:write","property:put",
  462.      *    "mandate:read",
  463.      *    "transaction-item:read",
  464.      *    "milkiya:read"
  465.      * })
  466.      *
  467.      */
  468.     private ?bool $hasCellar;
  469.     /**
  470.      * @ORM\Column(type="boolean")
  471.      *
  472.      * @Groups({
  473.      *    "property:read","property:write","property:put",
  474.      *    "mandate:read",
  475.      *    "transaction-item:read",
  476.      *    "milkiya:read"
  477.      * })
  478.      */
  479.     private ?bool $hasBasement;
  480.     /**
  481.      * @ORM\Column(type="boolean", nullable=true)
  482.      *
  483.      * @Groups({
  484.      *    "property:read","property:write","property:put",
  485.      *    "mandate:read",
  486.      *    "transaction-item:read",
  487.      *    "milkiya:read"
  488.      * })
  489.      */
  490.     private ?bool $hasBathroom;
  491.     /**
  492.      * @ORM\Column(type="text")
  493.      *
  494.      * @Groups({
  495.      *    "property:read","property:write","property:put",
  496.      *    "mandate:read",
  497.      *    "transaction-item:read"
  498.      * })
  499.      */
  500.     private ?string $description;
  501.     /**
  502.      * @ORM\OneToOne(targetEntity=PropertyAddress::class, inversedBy="property", cascade={"persist", "remove"})
  503.      * @ORM\JoinColumn(nullable=false)
  504.      * @Assert\NotBlank
  505.      * @Groups({
  506.      *    "property:read","property:write","property:put",
  507.      *    "mandate:read",
  508.      *    "transaction-item:read",
  509.      *    "property-visit:read",
  510.      *    "milkiya:read",
  511.      *    "business-indication:item:read",
  512.      *    "contact:read"
  513.      * })
  514.      * @App\Validator\Neighborhood()
  515.      */
  516.     private ?PropertyAddress $propertyAddress;
  517.     /**
  518.      * @ORM\ManyToOne(targetEntity=Agent::class, inversedBy="properties")
  519.      *
  520.      * @Groups({
  521.      *    "property:read","mandate:read",
  522.      *    "transaction-item:read","siege:write","siege:put",
  523.      *    "milkiya:read",
  524.      *    "business-indication:item:read",
  525.      * })
  526.      *
  527.      */
  528.     private ?Agent $collaborator;
  529.     /**
  530.      * @ORM\Column(type="datetime", nullable=true)
  531.      */
  532.     private ?DateTimeInterface $archivedAt;
  533.     /**
  534.      * @ORM\ManyToOne(targetEntity=Contact::class, inversedBy="properties",cascade={"persist"})
  535.      *
  536.      * @Groups({
  537.      *    "property:read","property:write","property:put",
  538.      *    "transaction-item:read",
  539.      *    "mandate:read",
  540.      *    "transaction-item:read",
  541.      *    "business-indication:item:read",
  542.      *    "property-visit:read"
  543.      *
  544.      * })
  545.      */
  546.     private ?Contact $contact;
  547.     /**
  548.      * @ORM\OneToMany(
  549.      *     targetEntity="App\Entity\PropertyImages",
  550.      *     mappedBy="property",cascade={"persist"},
  551.      *     orphanRemoval=true)
  552.      * @ORM\JoinColumn(nullable=true)
  553.      * @ORM\OrderBy({"position"="Asc"})
  554.      * @Groups({"property:read","milkiya:read"})
  555.      */
  556.     private $images;
  557.     /**
  558.      * @ORM\OneToMany(targetEntity=Mandate::class, mappedBy="property")
  559.      * @Groups({
  560.      *    "property:read"
  561.      * })
  562.      */
  563.     private $mandates;
  564.     /**
  565.      * @ORM\ManyToOne(targetEntity=Prescriber::class, inversedBy="properties",cascade={"persist"})
  566.      * @Groups({
  567.      *     "property:read","property:write","property:put",
  568.      *     "mandate:read",
  569.      *     "transaction-item:read"
  570.      * })
  571.      */
  572.     private ?Prescriber $prescriber;
  573.     /**
  574.      * @ORM\ManyToOne(targetEntity=Manager::class, inversedBy="properties")
  575.      * @Groups({
  576.      *   "mandate:read"
  577.      * })
  578.      */
  579.     private ?Manager $manager;
  580.     /**
  581.      * @ORM\ManyToOne(targetEntity=ReferencePropertyDomain::class, inversedBy="properties")
  582.      * @ORM\JoinColumn(nullable=true)
  583.      * @Groups({
  584.      *    "property:read","property:write","property:put",
  585.      *    "mandate:read",
  586.      *    "transaction-item:read",
  587.      *    "milkiya:read",
  588.      *    "business-indication:item:read"
  589.      * })
  590.      *
  591.      */
  592.     private ?ReferencePropertyDomain $referencePropertyDomain;
  593.     /**
  594.      * @ORM\ManyToOne(targetEntity=ReferencePropertyState::class, inversedBy="properties")
  595.      * @ORM\JoinColumn(nullable=true)
  596.      * @Groups({
  597.      *    "property:read","property:write","property:put",
  598.      *    "mandate:read",
  599.      *    "transaction-item:read",
  600.      *    "milkiya:read",
  601.      *    "business-indication:item:read",
  602.      *    "property-visit:read",
  603.      * })
  604.      */
  605.     private ?ReferencePropertyState $refrencePropertyState;
  606.     /**
  607.      * @ORM\ManyToOne(targetEntity=ReferencePropertyContractType::class, inversedBy="properties")
  608.      * @ORM\JoinColumn(nullable=true)
  609.      * @Groups({
  610.      *    "property:read","property:write","property:put",
  611.      *    "mandate:read",
  612.      *    "transaction-item:read",
  613.      *    "business-indication:item:read",
  614.      *    "milkiya:read",
  615.      *    "property-visit:read"
  616.      * })
  617.      */
  618.     private ?ReferencePropertyContractType $referencePropertyContractType;
  619.     /**
  620.      * @ORM\ManyToOne(targetEntity=ReferencePropertyLandType::class, inversedBy="properties")
  621.      * @ORM\JoinColumn(nullable=true)
  622.      * @Groups({
  623.      *    "property:read","property:write","property:put",
  624.      *    "mandate:read",
  625.      *    "transaction-item:read",
  626.      *    "business-indication:item:read",
  627.      *    "milkiya:read",
  628.      *    "property-visit:read"
  629.      * })
  630.      */
  631.     private ?ReferencePropertyLandType $referencePropertyLandType;
  632.     /**
  633.      * @ORM\ManyToOne(targetEntity=ReferencePropertyDestination::class, inversedBy="properties")
  634.      * @ORM\JoinColumn(nullable=true)
  635.      * @Groups({
  636.      *    "property:read","property:write","property:put",
  637.      *    "mandate:read",
  638.      *    "transaction-item:read",
  639.      *    "milkiya:read",
  640.      *    "business-indication:item:read",
  641.      *    "property-visit:read"
  642.      * })
  643.      */
  644.     private ?ReferencePropertyDestination $referencePropertyDestination;
  645.     /**
  646.      * @ORM\ManyToOne(targetEntity=ReferencePropertyConstructionType::class, inversedBy="properties")
  647.      * @ORM\JoinColumn(nullable=true)
  648.      * @Groups({
  649.      *    "property:read","property:write","property:put",
  650.      *    "mandate:read",
  651.      *    "transaction-item:read",
  652.      *    "milkiya:read",
  653.      *    "business-indication:item:read"
  654.      * })
  655.      */
  656.     private ?ReferencePropertyConstructionType $referencePropertyConstructionType;
  657.     /**
  658.      * @ORM\ManyToOne(targetEntity=ReferencePropertyOrientation::class, inversedBy="properties")
  659.      * @ORM\JoinColumn(nullable=true)
  660.      *
  661.      * @Groups({
  662.      *    "property:read","property:write","property:put",
  663.      *    "mandate:read",
  664.      *    "transaction-item:read",
  665.      *    "milkiya:read",
  666.      *    "business-indication:item:read"
  667.      * })
  668.      */
  669.     private ?ReferencePropertyOrientation $referencePropertyOrientationType;
  670.     /**
  671.      * @ORM\ManyToOne(targetEntity=ReferencePropertyStatus::class, inversedBy="properties")
  672.      * @ORM\JoinColumn(nullable=false)
  673.      * @Groups({
  674.      *    "property:read","siege:write","siege:put",
  675.      *    "mandate:read",
  676.      *    "transaction-item:read",
  677.      *    "milkiya:read"
  678.      * })
  679.      */
  680.     private ?ReferencePropertyStatus $referencePropertyStatus;
  681.     /**
  682.      * @ORM\ManyToOne(targetEntity=ReferencePropertyServiceType::class, inversedBy="properties")
  683.      * @ORM\JoinColumn(nullable=true)
  684.      *
  685.      * @Groups({
  686.      *    "property:read","property:write","property:put",
  687.      *    "mandate:read",
  688.      *    "transaction-item:read",
  689.      *    "milkiya:read",
  690.      *    "business-indication:item:read",
  691.      *    "property-visit:read"
  692.      * })
  693.      */
  694.     private ?ReferencePropertyServiceType $referenceServiceType;
  695.     /**
  696.      * @ORM\ManyToOne(targetEntity=ReferencePropertyType::class)
  697.      * @ORM\JoinColumn(nullable=true)
  698.      *
  699.      * @Groups({
  700.      *    "property:read","property:write","property:put",
  701.      *    "mandate:read",
  702.      *    "transaction-item:read",
  703.      *    "milkiya:read",
  704.      *    "business-indication:item:read",
  705.      *    "contact:read",
  706.      *    "property-visit:read"
  707.      * })
  708.      */
  709.     private ?ReferencePropertyType $referencePropertyType;
  710.     /**
  711.      * @ORM\ManyToOne(targetEntity=Agent::class, inversedBy="recommandations")
  712.      *
  713.      * @Groups({
  714.      *    "property:read","property:write","property:put",
  715.      *    "mandate:read",
  716.      *    "transaction-item:read"
  717.      * })
  718.      */
  719.     private $recommendation;
  720.     /**
  721.      * @var Collection |null
  722.      *
  723.      * @Groups({
  724.      *    "property:read","property:write","property:put",
  725.      *    "mandate:read",
  726.      *    "transaction-item:read"
  727.      * })
  728.      *
  729.      * @ORM\OneToMany(targetEntity=PropertyMatchingEntity::class, mappedBy="property")
  730.      */
  731.     private ?Collection $matchingEntity null;
  732.     /**
  733.      * @ORM\ManyToMany(targetEntity=PropertyDiffusionModeReference::class)
  734.      *
  735.      * @Groups({
  736.      *    "property:read","property:write","property:put",
  737.      *    "mandate:read",
  738.      *    "transaction-item:read"
  739.      * })
  740.      */
  741.     private $referencePropertyDiffusionMode;
  742.     /**
  743.      * @ORM\Column(type="string", length=255, nullable=true)
  744.      *
  745.      * @Groups({
  746.      *    "property:read","property:write","property:put",
  747.      *    "mandate:read",
  748.      *    "business-indication:item:read"
  749.      * })
  750.      */
  751.     private ?string $propertyTitleNumber;
  752.     /**
  753.      * @ORM\Column(type="string", length=255, nullable=true)
  754.      *
  755.      * @Groups({
  756.      *    "property:read","property:write","property:put",
  757.      *    "mandate:read",
  758.      *    "business-indication:item:read"
  759.      * })
  760.      */
  761.     private ?string $bookingNumber;
  762.     /**
  763.      * @ORM\OneToMany(
  764.      *     targetEntity="App\Entity\CertificateOfOwnershipFile",
  765.      *     mappedBy="property",
  766.      *     cascade={"persist"},
  767.      *     orphanRemoval=true)
  768.      * @ORM\JoinColumn(nullable=true)
  769.      * @Groups({"property:read","mandate:read"})
  770.      */
  771.     private $propertyFiles null;
  772.     /**
  773.      * @ORM\Column(type="integer",nullable=true)
  774.      *
  775.      * @Groups({
  776.      *    "property:read","property:write","property:put",
  777.      *    "mandate:read",
  778.      *    "transaction-item:read",
  779.      *    "milkiya:read",
  780.      *    "business-indication:item:read"
  781.      * })
  782.      *
  783.      */
  784.     private ?int $floor;
  785.     /**
  786.      * @ORM\Column(type="integer", nullable=true)
  787.      *
  788.      * @Groups({
  789.      *    "property:read","property:write","property:put",
  790.      *    "mandate:read",
  791.      *    "transaction-item:read",
  792.      *    "milkiya:read",
  793.      *    "business-indication:item:read"
  794.      * })
  795.      */
  796.     private ?int $bathroomNumber;
  797.     /**
  798.      * @ORM\Column(type="integer", nullable=true)
  799.      *
  800.      * @Groups({
  801.      *    "property:read","property:write","property:put",
  802.      *    "mandate:read",
  803.      *    "transaction-item:read",
  804.      *    "milkiya:read"
  805.      *
  806.      * })
  807.      */
  808.     private ?int $numberOfRooms;
  809.     /**
  810.      * @ORM\Column(type="integer", nullable=true)
  811.      *
  812.      * @Groups({
  813.      *    "property:read","property:write","property:put",
  814.      *    "mandate:read",
  815.      *    "transaction-item:read",
  816.      *    "milkiya:read"
  817.      * })
  818.      */
  819.     private ?int $numberOfPieces;
  820.     /**
  821.      * @ORM\OneToMany(targetEntity=PropertyDescription::class, mappedBy="property",cascade={"all"})
  822.      *
  823.      * @Groups({
  824.      *    "property:read","property:write","property:put",
  825.      *    "mandate:read",
  826.      *    "transaction-item:read",
  827.      *    "milkiya:read"
  828.      * })
  829.      */
  830.     private $propertyDescriptions;
  831.     /**
  832.      * @ORM\Column(type="string", length=255, nullable=true)
  833.      *
  834.      * @Groups({
  835.      *    "milkiya:read","property:read"
  836.      * })
  837.      */
  838.     private ?string $reference;
  839.     /**
  840.      * @ORM\ManyToMany(targetEntity=Agent::class)
  841.      *
  842.      * @Groups({
  843.      *    "property:read","property:write","property:put",
  844.      *    "mandate:read",
  845.      *    "transaction-item:read",
  846.      *    "milkiya:read"
  847.      * })
  848.      */
  849.     private $agentsSharedWith;
  850.     /**
  851.      * @ORM\Column(type="boolean", nullable=true)
  852.      *
  853.      * @Groups({
  854.      *    "property:read","property:write","property:put",
  855.      *    "mandate:read",
  856.      *    "transaction-item:read",
  857.      *    "milkiya:read"
  858.      * })
  859.      */
  860.     private ?bool $isShared false;
  861.     /**
  862.      * @ORM\Column(type="boolean", nullable=true)
  863.      *
  864.      * @Groups({
  865.      *    "property:read","property:write","property:put"
  866.      * })
  867.      */
  868.     private ?bool $hasTitledParking false;
  869.     /**
  870.      * @ORM\Column(type="float", nullable=true)
  871.      *
  872.      * @Groups({
  873.      *    "property:read","property:write","property:put"
  874.      * })
  875.      */
  876.     private ?float $parkingArea;
  877.     /**
  878.      * @ORM\Column(type="boolean", nullable=true)
  879.      *
  880.      * @Groups({
  881.      *    "property:read","property:write","property:put"
  882.      * })
  883.      */
  884.     private ?bool $hasMezzanine false;
  885.     /**
  886.      * @ORM\Column(type="float", nullable=true)
  887.      *
  888.      * @Groups({
  889.      *    "property:read","property:write","property:put"
  890.      * })
  891.      *
  892.      */
  893.     private ?float $mezzanineArea;
  894.     /**
  895.      * @ORM\Column(type="text", nullable=true)
  896.      *
  897.      * @Groups({
  898.      *    "property:read","property:write","property:put"
  899.      * })
  900.      */
  901.     private ?string $descriptionMandate;
  902.     /**
  903.      * @ORM\Column(type="boolean", nullable=true)
  904.      * @Groups({
  905.      *    "property:read","property:write","property:put",
  906.      *    "mandate:read"
  907.      * })
  908.      */
  909.     private ?bool $isShortTermRental null;
  910.     /**
  911.      * @ORM\Column(type="datetime", nullable=true)
  912.      * @Groups({
  913.      *    "property:read","property:write","property:put",
  914.      *    "mandate:read"
  915.      * })
  916.      */
  917.     private ?DateTimeInterface $dateStartRental null;
  918.     /**
  919.      * @ORM\Column(type="datetime", nullable=true)
  920.      * @Groups({
  921.      *    "property:read","property:write","property:put",
  922.      *    "mandate:read"
  923.      * })
  924.      */
  925.     private ?DateTimeInterface $dateEndRental null;
  926.     /**
  927.      * @ORM\Column(type="string",nullable=true)
  928.      *
  929.      * @Groups({"property:read", "property:write","property:put", "milkiya:read"})
  930.      */
  931.     private ?string $videoLink;
  932.     public function __construct()
  933.     {
  934.         $this->mandates = new ArrayCollection();
  935.         $this->referencePropertyDiffusionMode = new ArrayCollection();
  936.         $this->propertyFiles = new ArrayCollection();
  937.         $this->propertyDescriptions = new ArrayCollection();
  938.         $this->matchingEntity = new ArrayCollection();
  939.         $this->agentsSharedWith = new ArrayCollection();
  940.     }
  941.     public function getId(): ?int
  942.     {
  943.         return $this->id;
  944.     }
  945.     public function setId(?int $id): self
  946.     {
  947.         $this->id $id;
  948.         return $this;
  949.     }
  950.     public function getMaximalArea(): ?float
  951.     {
  952.         return $this->maximalArea;
  953.     }
  954.     public function setMaximalArea(?float $maximalArea): self
  955.     {
  956.         $this->maximalArea $maximalArea;
  957.         return $this;
  958.     }
  959.     public function getMinimalArea(): ?float
  960.     {
  961.         return $this->minimalArea;
  962.     }
  963.     public function setMinimalArea(?float $minimalArea): self
  964.     {
  965.         $this->minimalArea $minimalArea;
  966.         return $this;
  967.     }
  968.     public function getMinimalPrice(): ?float
  969.     {
  970.         return $this->minimalPrice;
  971.     }
  972.     public function setMinimalPrice(?float $minimalPrice): self
  973.     {
  974.         $this->minimalPrice $minimalPrice;
  975.         return $this;
  976.     }
  977.     public function getMaximumPrice(): ?float
  978.     {
  979.         return $this->maximumPrice;
  980.     }
  981.     public function setMaximumPrice(float $maximumPrice): self
  982.     {
  983.         $this->maximumPrice $maximumPrice;
  984.         return $this;
  985.     }
  986.     public function getRoomsNumber(): ?int
  987.     {
  988.         return $this->roomsNumber;
  989.     }
  990.     public function setRoomsNumber(?int $roomsNumber): self
  991.     {
  992.         $this->roomsNumber $roomsNumber;
  993.         return $this;
  994.     }
  995.     public function getIsAvailable(): ?bool
  996.     {
  997.         return $this->isAvailable;
  998.     }
  999.     public function setIsAvailable(bool $isAvailable): self
  1000.     {
  1001.         $this->isAvailable $isAvailable;
  1002.         return $this;
  1003.     }
  1004.     public function getIsFurnished(): ?bool
  1005.     {
  1006.         return $this->isFurnished;
  1007.     }
  1008.     public function setIsFurnished(bool $isFurnished): self
  1009.     {
  1010.         $this->isFurnished $isFurnished;
  1011.         return $this;
  1012.     }
  1013.     public function getDateAvailability(): ?DateTimeInterface
  1014.     {
  1015.         return $this->dateAvailability;
  1016.     }
  1017.     public function setDateAvailability(?DateTimeInterface $dateAvailability): self
  1018.     {
  1019.         $this->dateAvailability $dateAvailability;
  1020.         return $this;
  1021.     }
  1022.     public function getConstructionYear(): ?DateTimeInterface
  1023.     {
  1024.         return $this->constructionYear;
  1025.     }
  1026.     public function setConstructionYear(?DateTimeInterface $constructionYear): self
  1027.     {
  1028.         $this->constructionYear $constructionYear;
  1029.         return $this;
  1030.     }
  1031.     public function getFloorsNumber(): ?int
  1032.     {
  1033.         return $this->floorsNumber;
  1034.     }
  1035.     public function setFloorsNumber(?int $floorsNumber): self
  1036.     {
  1037.         $this->floorsNumber $floorsNumber;
  1038.         return $this;
  1039.     }
  1040.     public function getHasGuardian(): ?bool
  1041.     {
  1042.         return $this->hasGuardian;
  1043.     }
  1044.     public function setHasGuardian(bool $hasGuardian): self
  1045.     {
  1046.         $this->hasGuardian $hasGuardian;
  1047.         return $this;
  1048.     }
  1049.     public function getHasIntercom(): ?bool
  1050.     {
  1051.         return $this->hasIntercom;
  1052.     }
  1053.     public function setHasIntercom(bool $hasIntercom): self
  1054.     {
  1055.         $this->hasIntercom $hasIntercom;
  1056.         return $this;
  1057.     }
  1058.     public function getHasElevator(): ?bool
  1059.     {
  1060.         return $this->hasElevator;
  1061.     }
  1062.     public function setHasElevator(bool $hasElevator): self
  1063.     {
  1064.         $this->hasElevator $hasElevator;
  1065.         return $this;
  1066.     }
  1067.     public function getHasTerrace(): ?bool
  1068.     {
  1069.         return $this->hasTerrace;
  1070.     }
  1071.     public function setHasTerrace(bool $hasTerrace): self
  1072.     {
  1073.         $this->hasTerrace $hasTerrace;
  1074.         return $this;
  1075.     }
  1076.     public function getHasBalcony(): ?bool
  1077.     {
  1078.         return $this->hasBalcony;
  1079.     }
  1080.     public function setHasBalcony(bool $hasBalcony): self
  1081.     {
  1082.         $this->hasBalcony $hasBalcony;
  1083.         return $this;
  1084.     }
  1085.     public function getHasGarage(): ?bool
  1086.     {
  1087.         return $this->hasGarage;
  1088.     }
  1089.     public function setHasGarage(bool $hasGarage): self
  1090.     {
  1091.         $this->hasGarage $hasGarage;
  1092.         return $this;
  1093.     }
  1094.     public function getHasParkCar(): ?bool
  1095.     {
  1096.         return $this->hasParkCar;
  1097.     }
  1098.     public function setHasParkCar(bool $hasParkCar): self
  1099.     {
  1100.         $this->hasParkCar $hasParkCar;
  1101.         return $this;
  1102.     }
  1103.     public function getHasParkCarOutside(): ?bool
  1104.     {
  1105.         return $this->hasParkCarOutside;
  1106.     }
  1107.     public function setHasParkCarOutside(bool $hasParkCarOutside): self
  1108.     {
  1109.         $this->hasParkCarOutside $hasParkCarOutside;
  1110.         return $this;
  1111.     }
  1112.     public function getHasCellar(): ?bool
  1113.     {
  1114.         return $this->hasCellar;
  1115.     }
  1116.     public function setHasCellar(bool $hasCellar): self
  1117.     {
  1118.         $this->hasCellar $hasCellar;
  1119.         return $this;
  1120.     }
  1121.     public function getHasBasement(): ?bool
  1122.     {
  1123.         return $this->hasBasement;
  1124.     }
  1125.     public function setHasBasement(bool $hasBasement): self
  1126.     {
  1127.         $this->hasBasement $hasBasement;
  1128.         return $this;
  1129.     }
  1130.     public function getCollaborator(): ?Agent
  1131.     {
  1132.         return $this->collaborator;
  1133.     }
  1134.     public function setCollaborator(?Agent $collaborator): self
  1135.     {
  1136.         $this->collaborator $collaborator;
  1137.         return $this;
  1138.     }
  1139.     public function getArchivedAt(): ?DateTimeInterface
  1140.     {
  1141.         return $this->archivedAt;
  1142.     }
  1143.     public function setArchivedAt(?DateTimeInterface $archivedAt): self
  1144.     {
  1145.         $this->archivedAt $archivedAt;
  1146.         return $this;
  1147.     }
  1148.     public function getReferencePropertyType(): ?ReferencePropertyType
  1149.     {
  1150.         return $this->referencePropertyType;
  1151.     }
  1152.     public function setReferencePropertyType(?ReferencePropertyType $referencePropertyType): self
  1153.     {
  1154.         $this->referencePropertyType $referencePropertyType;
  1155.         return $this;
  1156.     }
  1157.     public function getReferencePropertyConstructionType(): ?ReferencePropertyConstructionType
  1158.     {
  1159.         return $this->referencePropertyConstructionType;
  1160.     }
  1161.     public function setReferencePropertyConstructionType(
  1162.         ?ReferencePropertyConstructionType $referencePropertyConstructionType
  1163.     ): self {
  1164.         $this->referencePropertyConstructionType $referencePropertyConstructionType;
  1165.         return $this;
  1166.     }
  1167.     public function getReferencePropertyOrientationType(): ?ReferencePropertyOrientation
  1168.     {
  1169.         return $this->referencePropertyOrientationType;
  1170.     }
  1171.     public function setReferencePropertyOrientationType(
  1172.         ?ReferencePropertyOrientation $referencePropertyOrientationType
  1173.     ): self {
  1174.         $this->referencePropertyOrientationType $referencePropertyOrientationType;
  1175.         return $this;
  1176.     }
  1177.     public function getPropertyAddress(): ?PropertyAddress
  1178.     {
  1179.         return $this->propertyAddress;
  1180.     }
  1181.     public function setPropertyAddress(PropertyAddress $propertyAddress): self
  1182.     {
  1183.         $this->propertyAddress $propertyAddress;
  1184.         return $this;
  1185.     }
  1186.     public function getContact(): ?Contact
  1187.     {
  1188.         return $this->contact;
  1189.     }
  1190.     public function setContact(?Contact $contact): self
  1191.     {
  1192.         $this->contact $contact;
  1193.         return $this;
  1194.     }
  1195.     /**
  1196.      * @return int
  1197.      */
  1198.     public function getNumberUnarchivedImages(): int
  1199.     {
  1200.         $count 0;
  1201.         foreach ($this->images as $img) {
  1202.             $img->getArchived() === false $count++ : null;
  1203.         }
  1204.         return $count;
  1205.     }
  1206.     /**
  1207.      * @return Collection|PropertyImages[]
  1208.      */
  1209.     public function getImages(): Collection
  1210.     {
  1211.         $imageInarchive = new ArrayCollection();
  1212.         foreach ($this->images as $img) {
  1213.             $img->getArchived() === false $imageInarchive[] = $img null;
  1214.         }
  1215.         return $imageInarchive;
  1216.     }
  1217.     /**
  1218.      * @param PropertyImages $image
  1219.      * @return $this
  1220.      */
  1221.     public function addImage(PropertyImages $image): self
  1222.     {
  1223.         if (!$this->images->contains($image)) {
  1224.             $this->images[] = $image;
  1225.             $image->setProperty($this);
  1226.         }
  1227.         return $this;
  1228.     }
  1229.     /**
  1230.      * @param PropertyImages $image
  1231.      * @return $this
  1232.      */
  1233.     public function removeImage(PropertyImages $image): self
  1234.     {
  1235.         // set the owning side to null (unless already changed)
  1236.         if ($this->images->removeElement($image) && $image->getProperty() === $this) {
  1237.             $image->setProperty(null);
  1238.         }
  1239.         return $this;
  1240.     }
  1241.     /**
  1242.      * @return Collection|Mandate[]
  1243.      */
  1244.     public function getMandates(): Collection
  1245.     {
  1246.         return $this->mandates->filter(function ($arrayItem) {
  1247.             return !in_array(
  1248.                 $arrayItem->getReferenceMandateStatus()->getCode(),
  1249.                 Mandate::REFERENCE_MANDATE_STATUS_CODE_INVALID,
  1250.                 false
  1251.             );
  1252.         });
  1253.     }
  1254.     public function addMandate(Mandate $mandate): self
  1255.     {
  1256.         if (!$this->mandates->contains($mandate)) {
  1257.             $this->mandates[] = $mandate;
  1258.             $mandate->setProperty($this);
  1259.         }
  1260.         return $this;
  1261.     }
  1262.     public function removeMandate(Mandate $mandate): self
  1263.     {
  1264.         // set the owning side to null (unless already changed)
  1265.         if ($this->mandates->removeElement($mandate) && $mandate->getProperty() === $this) {
  1266.             $mandate->setProperty(null);
  1267.         }
  1268.         return $this;
  1269.     }
  1270.     public function getPropertyFiles(): ?Collection
  1271.     {
  1272.         return $this->propertyFiles;
  1273.     }
  1274.     public function addPropertyFiles(CertificateOfOwnershipFile $certificateOfOwnershipFile): self
  1275.     {
  1276.         if (!$this->propertyFiles->contains($certificateOfOwnershipFile)) {
  1277.             $this->propertyFiles[] = $certificateOfOwnershipFile;
  1278.             $certificateOfOwnershipFile->setProperty($this);
  1279.         }
  1280.         return $this;
  1281.     }
  1282.     public function removePropertyFiles(CertificateOfOwnershipFile $certificateOfOwnershipFile): self
  1283.     {
  1284.         if ($this->propertyFiles->removeElement($certificateOfOwnershipFile)) {
  1285.             if ($certificateOfOwnershipFile->getProperty() === $this) {
  1286.                 $certificateOfOwnershipFile->setProperty(null);
  1287.             }
  1288.         }
  1289.         return $this;
  1290.     }
  1291.     public function getPrescriber(): ?Prescriber
  1292.     {
  1293.         return $this->prescriber;
  1294.     }
  1295.     public function setPrescriber(?Prescriber $prescriber): self
  1296.     {
  1297.         $this->prescriber $prescriber;
  1298.         return $this;
  1299.     }
  1300.     public function getReferencePropertyStatus(): ?ReferencePropertyStatus
  1301.     {
  1302.         return $this->referencePropertyStatus;
  1303.     }
  1304.     public function setReferencePropertyStatus(?ReferencePropertyStatus $referencePropertyStatus): self
  1305.     {
  1306.         $this->referencePropertyStatus $referencePropertyStatus;
  1307.         return $this;
  1308.     }
  1309.     public function getManager(): ?Manager
  1310.     {
  1311.         return $this->manager;
  1312.     }
  1313.     public function setManager(?Manager $manager): self
  1314.     {
  1315.         $this->manager $manager;
  1316.         return $this;
  1317.     }
  1318.     public function getReferenceServiceType(): ?ReferencePropertyServiceType
  1319.     {
  1320.         return $this->referenceServiceType;
  1321.     }
  1322.     public function setReferenceServiceType(?ReferencePropertyServiceType $referenceServiceType): self
  1323.     {
  1324.         $this->referenceServiceType $referenceServiceType;
  1325.         return $this;
  1326.     }
  1327.     public function getDescription(): ?string
  1328.     {
  1329.         return $this->description;
  1330.     }
  1331.     public function setDescription(string $description): self
  1332.     {
  1333.         $this->description $description;
  1334.         return $this;
  1335.     }
  1336.     public function getReferencePropertyDomain(): ?ReferencePropertyDomain
  1337.     {
  1338.         return $this->referencePropertyDomain;
  1339.     }
  1340.     public function setReferencePropertyDomain(?ReferencePropertyDomain $referencePropertyDomain): self
  1341.     {
  1342.         $this->referencePropertyDomain $referencePropertyDomain;
  1343.         return $this;
  1344.     }
  1345.     public function getRefrencePropertyState(): ?ReferencePropertyState
  1346.     {
  1347.         return $this->refrencePropertyState;
  1348.     }
  1349.     public function setRefrencePropertyState(?ReferencePropertyState $refrencePropertyState): self
  1350.     {
  1351.         $this->refrencePropertyState $refrencePropertyState;
  1352.         return $this;
  1353.     }
  1354.     public function getReferencePropertyContractType(): ?ReferencePropertyContractType
  1355.     {
  1356.         return $this->referencePropertyContractType;
  1357.     }
  1358.     public function setReferencePropertyContractType(
  1359.         ?ReferencePropertyContractType $referencePropertyContractType
  1360.     ): self {
  1361.         $this->referencePropertyContractType $referencePropertyContractType;
  1362.         return $this;
  1363.     }
  1364.     public function getReferencePropertyLandType(): ?ReferencePropertyLandType
  1365.     {
  1366.         return $this->referencePropertyLandType;
  1367.     }
  1368.     public function setReferencePropertyLandType(?ReferencePropertyLandType $referencePropertyLandType): self
  1369.     {
  1370.         $this->referencePropertyLandType $referencePropertyLandType;
  1371.         return $this;
  1372.     }
  1373.     public function getReferencePropertyDestination(): ?ReferencePropertyDestination
  1374.     {
  1375.         return $this->referencePropertyDestination;
  1376.     }
  1377.     public function setReferencePropertyDestination(?ReferencePropertyDestination $referencePropertyDestination): self
  1378.     {
  1379.         $this->referencePropertyDestination $referencePropertyDestination;
  1380.         return $this;
  1381.     }
  1382.     public function getRecommendation()
  1383.     {
  1384.         return $this->recommendation;
  1385.     }
  1386.     public function setRecommendation(?Agent $recommendation): self
  1387.     {
  1388.         $this->recommendation $recommendation;
  1389.         return $this;
  1390.     }
  1391.     /**
  1392.      * @return Collection|PropertyMatchingEntity[]
  1393.      */
  1394.     public function getMatchingEntity(): Collection
  1395.     {
  1396.         return $this->matchingEntity;
  1397.     }
  1398.     /**
  1399.      * @return bool
  1400.      * @SerializedName("hasValidMandate")
  1401.      * @Groups({
  1402.      *    "property:read","property:write","property:put",
  1403.      *    "transaction-item:read",
  1404.      *    "mandate:read",
  1405.      *    "transaction-item:read"
  1406.      * })
  1407.      */
  1408.     public function hasValidMandate(): bool
  1409.     {
  1410.         foreach ($this->mandates as $mandate) {
  1411.             if (
  1412.                 !in_array(
  1413.                     $mandate->getReferenceMandateStatus()->getCode(),
  1414.                     Mandate::REFERENCE_MANDATE_STATUS_CODE_INVALID
  1415.                 )
  1416.             ) {
  1417.                 return true;
  1418.             }
  1419.         }
  1420.         return false;
  1421.     }
  1422.     /**
  1423.      * @return bool
  1424.      * @SerializedName("hasValidMandateWithoutCheckAdditionalProperty")
  1425.      * @Groups({
  1426.      *    "property:read","property:write","property:put",
  1427.      *    "transaction-item:read",
  1428.      *    "mandate:read",
  1429.      *    "transaction-item:read"
  1430.      * })
  1431.      */
  1432.     public function hasValidMandateWithoutCheckAdditionalProperty(): bool
  1433.     {
  1434.         foreach ($this->mandates as $mandate) {
  1435.             if (
  1436.                 !in_array(
  1437.                     $mandate->getReferenceMandateStatus()->getCode(),
  1438.                     Mandate::REFERENCE_MANDATE_STATUS_CODE_INVALID,
  1439.                     true
  1440.                 )
  1441.                 && !$mandate->getIsAdditionalProperty()
  1442.             ) {
  1443.                 return true;
  1444.             }
  1445.         }
  1446.         return false;
  1447.     }
  1448.     /**
  1449.      * @SerializedName("getVMandate")
  1450.      * @Groups({
  1451.      *    "property:read"
  1452.      * })
  1453.      */
  1454.     public function getVMandate()
  1455.     {
  1456.         return $this->mandates->filter(function ($arrayItem) {
  1457.             return !in_array(
  1458.                 $arrayItem->getReferenceMandateStatus()->getCode(),
  1459.                 Mandate::REFERENCE_MANDATE_STATUS_CODE_INVALID,
  1460.                 false
  1461.             );
  1462.         })->getValues();
  1463.     }
  1464.     /**
  1465.      * @return Collection<int, PropertyDiffusionModeReference>
  1466.      */
  1467.     public function getReferencePropertyDiffusionMode(): Collection
  1468.     {
  1469.         return $this->referencePropertyDiffusionMode;
  1470.     }
  1471.     public function addReferencePropertyDiffusionMode(
  1472.         PropertyDiffusionModeReference $referencePropertyDiffusionMode
  1473.     ): self {
  1474.         if (!$this->referencePropertyDiffusionMode->contains($referencePropertyDiffusionMode)) {
  1475.             $this->referencePropertyDiffusionMode[] = $referencePropertyDiffusionMode;
  1476.         }
  1477.         return $this;
  1478.     }
  1479.     public function getPropertyTitleNumber(): ?string
  1480.     {
  1481.         return $this->propertyTitleNumber;
  1482.     }
  1483.     public function setPropertyTitleNumber(?string $propertyTitleNumber): self
  1484.     {
  1485.         $this->propertyTitleNumber $propertyTitleNumber;
  1486.         return $this;
  1487.     }
  1488.     public function removeReferencePropertyDiffusionMode(
  1489.         PropertyDiffusionModeReference $referencePropertyDiffusionMode
  1490.     ): self {
  1491.         $this->referencePropertyDiffusionMode->removeElement($referencePropertyDiffusionMode);
  1492.         return $this;
  1493.     }
  1494.     /**
  1495.      * @return string|null
  1496.      */
  1497.     public function getBookingNumber(): ?string
  1498.     {
  1499.         return $this->bookingNumber;
  1500.     }
  1501.     /**
  1502.      * @param string|null $bookingNumber
  1503.      *
  1504.      * @return $this
  1505.      */
  1506.     public function setBookingNumber(?string $bookingNumber): self
  1507.     {
  1508.         $this->bookingNumber $bookingNumber;
  1509.         return $this;
  1510.     }
  1511.     public function getFloor(): ?int
  1512.     {
  1513.         return $this->floor;
  1514.     }
  1515.     public function setFloor(?int $floor): self
  1516.     {
  1517.         $this->floor $floor;
  1518.         return $this;
  1519.     }
  1520.     public function isSale(): bool
  1521.     {
  1522.         if (null === $this->getReferenceServiceType()) {
  1523.             return false;
  1524.         }
  1525.         return $this->getReferenceServiceType()->getCode(
  1526.         ) === ReferencePropertyServiceType::REFERENCE_CODE_PROPERTY_SERVICE_TYPE_SELL;
  1527.     }
  1528.     public function isRent(): bool
  1529.     {
  1530.         if (null === $this->getReferenceServiceType()) {
  1531.             return false;
  1532.         }
  1533.         return $this->getReferenceServiceType()->getCode() ===
  1534.             ReferencePropertyServiceType::REFERENCE_CODE_PROPERTY_SERVICE_TYPE_RENTAL;
  1535.     }
  1536.     public function isBuy(): bool
  1537.     {
  1538.         if (null === $this->getReferenceServiceType()) {
  1539.             return false;
  1540.         }
  1541.         return in_array(
  1542.             $this->getReferenceServiceType()->getCode(),
  1543.             ReferencePropertyServiceType::ALL_REFERENCE_CODE_PROPERTY_SEARCH_TYPE,
  1544.             true
  1545.         );
  1546.     }
  1547.     public function isNew(): bool
  1548.     {
  1549.         if (null === $domainType $this->getReferencePropertyDomain()) {
  1550.             return false;
  1551.         }
  1552.         return $domainType->getCode() === ReferencePropertyDomain::REFERENCE_CODE_PROPERTY_DOMAIN_NEW;
  1553.     }
  1554.     public function isCommercialPropertyType(): bool
  1555.     {
  1556.         return $this->isCommercialProperty();
  1557.     }
  1558.     public function isDwellingPropertyType(): bool
  1559.     {
  1560.         return $this->isHabitationProperty();
  1561.     }
  1562.     public function isLotPropertyType(): bool
  1563.     {
  1564.         return $this->isLandProperty();
  1565.     }
  1566.     public function getBathroomNumber(): ?int
  1567.     {
  1568.         return $this->bathroomNumber;
  1569.     }
  1570.     public function setBathroomNumber(?int $bathroomNumber): self
  1571.     {
  1572.         $this->bathroomNumber $bathroomNumber;
  1573.         return $this;
  1574.     }
  1575.     public function getNumberOfRooms(): ?int
  1576.     {
  1577.         return $this->numberOfRooms;
  1578.     }
  1579.     public function setNumberOfRooms(?int $numberOfRooms): self
  1580.     {
  1581.         $this->numberOfRooms $numberOfRooms;
  1582.         return $this;
  1583.     }
  1584.     public function getNumberOfPieces(): ?int
  1585.     {
  1586.         return $this->numberOfPieces;
  1587.     }
  1588.     public function setNumberOfPieces(): self
  1589.     {
  1590.         $this->numberOfPieces $this->roomsNumber;
  1591.         return $this;
  1592.     }
  1593.     /**
  1594.      * @return Collection<int, PropertyDescription>
  1595.      */
  1596.     public function getPropertyDescriptions(): Collection
  1597.     {
  1598.         return $this->propertyDescriptions;
  1599.     }
  1600.     public function addPropertyDescription(PropertyDescription $propertyDescription): self
  1601.     {
  1602.         if (!$this->propertyDescriptions->contains($propertyDescription)) {
  1603.             $this->propertyDescriptions[] = $propertyDescription;
  1604.             $propertyDescription->setProperty($this);
  1605.         }
  1606.         return $this;
  1607.     }
  1608.     public function removePropertyDescription(PropertyDescription $propertyDescription): self
  1609.     {
  1610.         // set the owning side to null (unless already changed)
  1611.         if (
  1612.             $this->propertyDescriptions->removeElement($propertyDescription) &&
  1613.             $propertyDescription->getProperty() === $this
  1614.         ) {
  1615.             $propertyDescription->setProperty(null);
  1616.         }
  1617.         return $this;
  1618.     }
  1619.     public function getHasBathroom(): ?bool
  1620.     {
  1621.         return $this->hasBathroom;
  1622.     }
  1623.     public function setHasBathroom(?bool $hasBathroom): self
  1624.     {
  1625.         $this->hasBathroom $hasBathroom;
  1626.         return $this;
  1627.     }
  1628.     public function getReference(): ?string
  1629.     {
  1630.         return $this->reference;
  1631.     }
  1632.     public function setReference(?string $reference): self
  1633.     {
  1634.         $this->reference $reference;
  1635.         return $this;
  1636.     }
  1637.     /**
  1638.      * @param PropertyAddress $propertyAddress
  1639.      *
  1640.      * @return bool
  1641.      */
  1642.     public function hasSameAddress(PropertyAddress $propertyAddress): bool
  1643.     {
  1644.         $address $this->getPropertyAddress();
  1645.         return $address->getCity() === $propertyAddress->getCity() &&
  1646.             $address->getNeighborhood() === $propertyAddress->getNeighborhood() &&
  1647.             $address->getZipCode() === $propertyAddress->getZipCode() &&
  1648.             $address->getFirstAddress() === $propertyAddress->getFirstAddress();
  1649.     }
  1650.     /**
  1651.      * @param Contact $contact
  1652.      *
  1653.      * @Groups({"property:read"})
  1654.      *
  1655.      * @return bool
  1656.      */
  1657.     public function hasSameContact(Contact $contact): bool
  1658.     {
  1659.         return $this->getContact()->getId() === $contact->getId();
  1660.     }
  1661.     /**
  1662.      * @param UserInterface $object
  1663.      *
  1664.      * @return bool
  1665.      */
  1666.     public function hasSameCollaborator(UserInterface $object): bool
  1667.     {
  1668.         return $this->getCollaborator()->getId() === $object->getId();
  1669.     }
  1670.     /**
  1671.      * @param ReferencePropertyServiceType $propertyServiceType
  1672.      *
  1673.      * @Groups({"property:read"})
  1674.      *
  1675.      * @return bool
  1676.      */
  1677.     public function hasSamePropertyServiceType(ReferencePropertyServiceType $propertyServiceType): bool
  1678.     {
  1679.         return $this->getReferenceServiceType()->getCode() === $propertyServiceType->getCode();
  1680.     }
  1681.     /**
  1682.      * @Groups({"milkiya:read"})
  1683.      * @SerializedName("description")
  1684.      *
  1685.      * @return string|null
  1686.      */
  1687.     public function getWebsiteDescription(): ?string
  1688.     {
  1689.         return nl2br($this->description) ?? null;
  1690.     }
  1691.     /**
  1692.      * check if the property is a commercial property
  1693.      *
  1694.      * @return bool
  1695.      */
  1696.     public function isCommercialProperty(): bool
  1697.     {
  1698.         if (null === $destination $this->getReferencePropertyDestination()) {
  1699.             return false;
  1700.         }
  1701.         return $destination->isCommercial();
  1702.     }
  1703.     /**
  1704.      * check if the property is a dwelling property
  1705.      *
  1706.      * @return bool
  1707.      */
  1708.     public function isHabitationProperty(): bool
  1709.     {
  1710.         if (null === $destination $this->getReferencePropertyDestination()) {
  1711.             return false;
  1712.         }
  1713.         return $destination->isHabitation();
  1714.     }
  1715.     /**
  1716.      * check if the property is a land property
  1717.      *
  1718.      * @return bool
  1719.      */
  1720.     public function isLandProperty(): bool
  1721.     {
  1722.         if (null === $destination $this->getReferencePropertyDestination()) {
  1723.             return false;
  1724.         }
  1725.         return $destination->isLand();
  1726.     }
  1727.     /**
  1728.      * @return Collection<int, Agent>
  1729.      */
  1730.     public function getAgentsSharedWith(): Collection
  1731.     {
  1732.         return $this->agentsSharedWith;
  1733.     }
  1734.     public function addAgentsSharedWith(Agent $agentsSharedWith): self
  1735.     {
  1736.         if (!$this->agentsSharedWith->contains($agentsSharedWith)) {
  1737.             $this->agentsSharedWith[] = $agentsSharedWith;
  1738.         }
  1739.         return $this;
  1740.     }
  1741.     public function removeAgentsSharedWith(Agent $agentsSharedWith): self
  1742.     {
  1743.         $this->agentsSharedWith->removeElement($agentsSharedWith);
  1744.         return $this;
  1745.     }
  1746.     public function getIsShared(): ?bool
  1747.     {
  1748.         return $this->isShared;
  1749.     }
  1750.     public function setIsShared(?bool $isShared): self
  1751.     {
  1752.         $this->isShared $isShared;
  1753.         return $this;
  1754.     }
  1755.     public function getHasTitledParking(): ?bool
  1756.     {
  1757.         return $this->hasTitledParking;
  1758.     }
  1759.     public function setHasTitledParking(?bool $hasTitledParking): self
  1760.     {
  1761.         $this->hasTitledParking $hasTitledParking;
  1762.         return $this;
  1763.     }
  1764.     public function getParkingArea(): ?float
  1765.     {
  1766.         return $this->parkingArea;
  1767.     }
  1768.     public function setParkingArea(?float $parkingArea): self
  1769.     {
  1770.         $this->parkingArea $parkingArea;
  1771.         return $this;
  1772.     }
  1773.     public function getHasMezzanine(): ?bool
  1774.     {
  1775.         return $this->hasMezzanine;
  1776.     }
  1777.     public function setHasMezzanine(?bool $hasMezzanine): self
  1778.     {
  1779.         $this->hasMezzanine $hasMezzanine;
  1780.         return $this;
  1781.     }
  1782.     public function getMezzanineArea(): ?float
  1783.     {
  1784.         return $this->mezzanineArea;
  1785.     }
  1786.     public function setMezzanineArea(?float $mezzanineArea): self
  1787.     {
  1788.         $this->mezzanineArea $mezzanineArea;
  1789.         return $this;
  1790.     }
  1791.     /**
  1792.      * @return string|null
  1793.      */
  1794.     public function getDescriptionMandate(): ?string
  1795.     {
  1796.         return $this->descriptionMandate;
  1797.     }
  1798.     /**
  1799.      * @param string|null $descriptionMandate
  1800.      *
  1801.      * @return $this
  1802.      */
  1803.     public function setDescriptionMandate(?string $descriptionMandate): self
  1804.     {
  1805.         $this->descriptionMandate $descriptionMandate;
  1806.         return $this;
  1807.     }
  1808.     /**
  1809.      * @Groups({"property_images:read","property:read","milkiya:read","mandate:read"})
  1810.      * @Groups({"property_images:read","property:read","milkiya:read","mandate:read","property-visit:read"})
  1811.      */
  1812.     public function getMainPhotoUrl(): ?string
  1813.     {
  1814.         foreach ($this->images as $image) {
  1815.             if ($image->getPosition() === 1) {
  1816.                 return $image->contentUrl;
  1817.             }
  1818.         }
  1819.         return null;
  1820.     }
  1821.     /**
  1822.      * @return float
  1823.      *
  1824.      * @SerializedName("price")
  1825.      *
  1826.      * @Groups({"property:read","mandate:read"})
  1827.      */
  1828.     public function getPrice(): float
  1829.     {
  1830.         return $this->isSale() ? $this->getMinimalPrice() : $this->getMaximumPrice();
  1831.     }
  1832.     /**
  1833.      * @Groups({"milkiya:read"})
  1834.      */
  1835.     public function getMezzanine(): array
  1836.     {
  1837.         return ['available' => $this->hasMezzanine'area' => $this->mezzanineArea];
  1838.     }
  1839.     /**
  1840.      * @Groups({"milkiya:read"})
  1841.      */
  1842.     public function getTitledParking(): array
  1843.     {
  1844.         return ['available' => $this->hasTitledParking'area' => $this->parkingArea];
  1845.     }
  1846.     public function isIsShortTermRental(): ?bool
  1847.     {
  1848.         return $this->isShortTermRental;
  1849.     }
  1850.     public function setIsShortTermRental(?bool $isShortTermRental): self
  1851.     {
  1852.         $this->isShortTermRental $isShortTermRental;
  1853.         return $this;
  1854.     }
  1855.     public function getDateStartRental(): ?\DateTimeInterface
  1856.     {
  1857.         return $this->dateStartRental;
  1858.     }
  1859.     public function setDateStartRental(?\DateTimeInterface $dateStartRental): self
  1860.     {
  1861.         $this->dateStartRental $dateStartRental;
  1862.         return $this;
  1863.     }
  1864.     public function getDateEndRental(): ?\DateTimeInterface
  1865.     {
  1866.         return $this->dateEndRental;
  1867.     }
  1868.     public function setDateEndRental(?\DateTimeInterface $dateEndRental): self
  1869.     {
  1870.         $this->dateEndRental $dateEndRental;
  1871.         return $this;
  1872.     }
  1873.     /**
  1874.      * @return array
  1875.      */
  1876.     public function getFields(): array
  1877.     {
  1878.         return [
  1879.             'referencePropertyStatus' => 'referencePropertyStatus',
  1880.             'referencePropertyType' => 'referencePropertyType',
  1881.             'referenceServiceType' => 'referenceServiceType',
  1882.             'contact' => 'contact',
  1883.             'referencePropertyDiffusionMode' => 'referencePropertyDiffusionMode',
  1884.             'minimalArea' => 'minimalArea',
  1885.             'maximalArea' => 'maximalArea',
  1886.             'minimalPrice' => 'minimalPrice',
  1887.             'maximumPrice' => 'maximumPrice'
  1888.         ];
  1889.     }
  1890.     public function getVideoLink(): ?string
  1891.     {
  1892.         return $this->videoLink;
  1893.     }
  1894.     public function setVideoLink(?string $videoLink): self
  1895.     {
  1896.         $this->videoLink $videoLink;
  1897.         return $this;
  1898.     }
  1899. }