<?php

namespace App\Observers;

use App\Models\Ecommerce\Product\Property\ProductAttributeValue;

class ProductAttributeValueObserver
{
    /**
     * Handle the ProductAttributeValue "created" event.
     */
    public function created(ProductAttributeValue $productAttributeValue): void
    {
        $productAttributeValue->productProperty->product->syncPropertiesJson();
    }

    /**
     * Handle the ProductAttributeValue "updated" event.
     */
    public function updated(ProductAttributeValue $productAttributeValue): void
    {
        $productAttributeValue->productProperty->product->syncPropertiesJson();
    }

    /**
     * Handle the ProductAttributeValue "deleted" event.
     */
    public function deleted(ProductAttributeValue $productAttributeValue): void
    {
        $productAttributeValue->productProperty->product->syncPropertiesJson();
    }
}
