<?php  namespace App\Models;  use App\Enums\Language; use App\Mail\OrderSuccessMail; use App\Observers\OrderObserver; use Illuminate\Support\Facades\Mail; use Illuminate\Database\Eloquent\Builder; use App\Services\Payments\CorvusPayHandler; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\BelongsTo;  class Order extends Model { 	protected $casts = [ 		'paid_at' => 'datetime', 	];  	public static function calculatePrices(array $products, string $country): array 	{ 		$totalPrice = $totalWeight = 0;  		foreach ($products as $product) { 			$productModel = Product::with('item')->findOrFail($product['product_id']);  			$totalPrice += $productModel->getPrice() * $product['quantity']; 			$totalWeight += $productModel->getWeight() * $product['quantity']; 		}  		$deliveryPricelist = DeliveryPricelist::whereJsonContains('countries', $country)->first() ?? DeliveryPricelist::whereNull('countries')->first();  		$deliveryPrice = $deliveryPricelist?->getPriceForWeight($totalWeight) ?? 0;  		return [ 			'total_price' => round($totalPrice + $deliveryPrice, 2), 			'tax' => round($totalPrice - ($totalPrice / ((setting('tax') / 100) + 1)), 2), 			'tax_percent' => setting('tax'), 			'total_weight' => $totalWeight, 			'delivery_price' => round($deliveryPrice, 2), 		]; 	}  	protected static function initObservers(): string 	{ 		return OrderObserver::class; 	}  	public function customer(): BelongsTo{}  	public function deliveryPricelist(): BelongsTo{}  	public function products(): HasMany{}  	public function createReferenceNumber(): self{}  	public function recalculate(): self{}  	public function generateCorvusPayFormSignature(Language $language): string{}  	public function generateCorvusPaySuccessSignature(string $approvalCode, Language $language): string{}  	public function getSuccessUrl(Language $language): string{}  	public function getCancelUrl(Language $language): string{}  	public function isPaid(): bool{}  	public function sendSuccessMail(): self{}  	public function setNameAttribute(string $value): void{}  	public function setEmailAttribute(string $value): void{}  	public function setPhoneAttribute(string $value): void{}  	public function setCompanyNameAttribute(?string $value): void{}  	public function setVatAttribute(?string $value): void{}  	public function setDeliveryAddressAttribute(string $value): void{}  	public function setDeliveryCityAttribute(string $value): void{}  	public function setDeliveryZipCodeAttribute(string $value): void{}  	public function setDeliveryCountryAttribute(string $value): void{}  	public function setBillingAddressAttribute(string $value): void{}  	public function setBillingCityAttribute(string $value): void{}  	public function setBillingZipCodeAttribute(string $value): void{}  	public function setBillingCountryAttribute(string $value): void{}  	public function scopePaid(Builder $query): Builder{}  	public function scopeUnpaid(Builder $query): Builder{}  	public function scopeIncludes(Builder $query): Builder{}  	protected function getIncludes(): array{} }