user = $user; $this->createdAt = new \DateTimeImmutable(); } public function getCodeComptable(): ?string { return $this->codeComptable; } public function setCodeComptable(?string $codeComptable): static { $this->codeComptable = $codeComptable; return $this; } public function getRevendeurCode(): ?string { return $this->revendeurCode; } public function setRevendeurCode(?string $revendeurCode): static { $this->revendeurCode = $revendeurCode; return $this; } public function generateCodeComptable(): string { $idPart = str_pad((string) ($this->id ?? 0), 4, '0', STR_PAD_LEFT); $namePart = ''; if (null !== $this->raisonSociale && '' !== $this->raisonSociale) { $clean = preg_replace('/[^A-Za-z]/', '', $this->raisonSociale); $namePart = strtoupper(substr($clean, 0, 5)); } elseif (null !== $this->lastName && '' !== $this->lastName) { $clean = preg_replace('/[^A-Za-z]/', '', $this->lastName); $namePart = strtoupper(substr($clean, 0, 5)); } $namePart = str_pad($namePart, 5, 'X'); return 'EC-'.$idPart.'-'.$namePart; } public function getId(): ?int { return $this->id; } public function getUser(): User { return $this->user; } public function getRaisonSociale(): ?string { return $this->raisonSociale; } public function setRaisonSociale(?string $raisonSociale): static { $this->raisonSociale = $raisonSociale; return $this; } public function getFirstName(): ?string { return $this->firstName; } public function setFirstName(?string $firstName): static { $this->firstName = $firstName; return $this; } public function getLastName(): ?string { return $this->lastName; } public function setLastName(?string $lastName): static { $this->lastName = $lastName; return $this; } public function getFullName(): string { if (null !== $this->raisonSociale && '' !== $this->raisonSociale) { return $this->raisonSociale; } return trim(($this->firstName ?? '').' '.($this->lastName ?? '')); } public function getEmail(): ?string { return $this->email; } public function setEmail(?string $email): static { $this->email = $email; return $this; } public function getPhone(): ?string { return $this->phone; } public function setPhone(?string $phone): static { $this->phone = $phone; return $this; } public function getAddress(): ?string { return $this->address; } public function setAddress(?string $address): static { $this->address = $address; return $this; } public function getAddress2(): ?string { return $this->address2; } public function setAddress2(?string $address2): static { $this->address2 = $address2; return $this; } public function getZipCode(): ?string { return $this->zipCode; } public function setZipCode(?string $zipCode): static { $this->zipCode = $zipCode; return $this; } public function getCity(): ?string { return $this->city; } public function setCity(?string $city): static { $this->city = $city; return $this; } public function getGeoLat(): ?string { return $this->geoLat; } public function setGeoLat(?string $geoLat): static { $this->geoLat = $geoLat; return $this; } public function getGeoLong(): ?string { return $this->geoLong; } public function setGeoLong(?string $geoLong): static { $this->geoLong = $geoLong; return $this; } public function getSiret(): ?string { return $this->siret; } public function setSiret(?string $siret): static { $this->siret = $siret; return $this; } public function getRcs(): ?string { return $this->rcs; } public function setRcs(?string $rcs): static { $this->rcs = $rcs; return $this; } public function getNumTva(): ?string { return $this->numTva; } public function setNumTva(?string $numTva): static { $this->numTva = $numTva; return $this; } public function getApe(): ?string { return $this->ape; } public function setApe(?string $ape): static { $this->ape = $ape; return $this; } public function getRna(): ?string { return $this->rna; } public function setRna(?string $rna): static { $this->rna = $rna; return $this; } public function getStripeCustomerId(): ?string { return $this->stripeCustomerId; } public function setStripeCustomerId(?string $stripeCustomerId): static { $this->stripeCustomerId = $stripeCustomerId; return $this; } public function getTypeCompany(): ?string { return $this->typeCompany; } public function setTypeCompany(?string $typeCompany): static { $this->typeCompany = $typeCompany; return $this; } public function getState(): string { return $this->state; } public function setState(string $state): static { $this->state = $state; $this->updatedAt = new \DateTimeImmutable(); return $this; } public function isActive(): bool { return self::STATE_ACTIVE === $this->state; } public function isPendingDelete(): bool { return self::STATE_PENDING_DELETE === $this->state; } public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; } public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updatedAt; } public function setUpdatedAt(?\DateTimeImmutable $updatedAt): static { $this->updatedAt = $updatedAt; return $this; } }