HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/shop.komma.nl/resources/js/components/vue/discounts/models/Discount.js
import AbstractTranslatable from "../../../../global/models/AbstractTranslatable";
import DiscountTranslation from "./DiscountTranslation";
import Condition from "./Condition";
import Action from "./Action";

export default class Discount extends AbstractTranslatable {
    /**
     * @return {boolean}
     */
    get active() {
        return this._active;
    }

    /**
     * @param {boolean} value
     */
    set active(value) {
        if(typeof value !== 'boolean' && typeof value !== 'number') {
            this._active = true
        } else {
            this._active = !!value
        }
    }

    /**
     * @return {boolean}
     */
    get stop_processing() {
        return this._stop_processing;
    }

    /**
     * @param {boolean} value
     */
    set stop_processing(value) {
        if(typeof value !== 'boolean' && typeof value !== 'number') {
            this._stop_processing = false
        } else {
            this._stop_processing = !!value
        }
    }

    /**
     * @return {DiscountTranslation[]}
     */
    get translations() {
        if(!Array.isArray(this._translations)) this._translations = [];
        return this._translations;
    }

    /**
     * @param {DiscountTranslation[]|[{}]} values
     */
    set translations(values) {
        this._translations = [];
        if(typeof values === "undefined") values = []
        values.forEach((translation) => {
            if(translation instanceof DiscountTranslation) this._translations.push(translation)
            else this._translations.push(new DiscountTranslation(translation))
        });
    }

    /**
     * @return {DiscountTranslation|{}}
     */
    get translation() {
        return this._translation;
    }

    /**
     * @param {DiscountTranslation|{}} value
     */
    set translation(value) {
        if(typeof value === "undefined") this._translation = null
        else if(value instanceof DiscountTranslation) this._translation = value;
        else this._translation = new DiscountTranslation(value)

    }

    /**
     * @return {Condition[]|[]}
     */
    get conditions() {
        if(!Array.isArray(this._conditions)) this._conditions = [];
        return this._conditions
    }

    /**
     * @param {Condition[]|[{}]} values
     */
    set conditions(values) {
        this._conditions = [];
        if(typeof values === "undefined") values = []
        values.forEach((value) => {
            if(value instanceof Condition) this._conditions.push(value)
            else this._conditions.push(new Condition(value))
        });
    }

    /**
     * @return {Action[]|[]}
     */
    get actions() {
        if(!Array.isArray(this._actions)) this._actions = [];
        return this._actions
    }

    /**
     * @param {Action[]|[{}]} values
     */
    set actions(values) {
        this._actions = [];
        if(typeof values === "undefined") values = []
        values.forEach((value) => {
            if(value instanceof Action) this._actions.push(value)
            else this._actions.push(new Action(value))
        });
    }
}