package com.spring.core.event.productcategory;

import com.spring.core.event.DeletedEvent;

/**
 * @author vahid hosseinzadeh
 * @version 1.0
 * @since 1.0
 */

public class ProductCategoryDeletedEvent extends DeletedEvent {
    private long id;
    private ProductCategoryDetails productCategoryDetails;
    private boolean deletionCompleted;

    public ProductCategoryDeletedEvent(long id) {
        this.id = id;
    }

    public ProductCategoryDeletedEvent(long id, ProductCategoryDetails productCategoryDetails) {
        this.id = id;
        this.productCategoryDetails = productCategoryDetails;
        this.deletionCompleted = true;
    }

    public ProductCategoryDetails getProductCategoryDetails() {
        return productCategoryDetails;
    }

    public boolean isDeletionCompleted() {
        return deletionCompleted;
    }

    public static ProductCategoryDeletedEvent deletionForbidden(long id, ProductCategoryDetails productCategoryDetails) {
        ProductCategoryDeletedEvent ev = new ProductCategoryDeletedEvent(id, productCategoryDetails);
        ev.entityFound = true;
        ev.deletionCompleted = false;
        return ev;
    }

    public static ProductCategoryDeletedEvent notFound(long id) {
        ProductCategoryDeletedEvent ev = new ProductCategoryDeletedEvent(id);
        ev.entityFound = false;
        return ev;
    }
}
