import { gte } from 'semver';
import { ___NS__merge } from 'tnp-core/lib-prod';
//#region base worker config
export class BaseCliWorkerConfig {
    static from(opt) {
        return ___NS__merge(new BaseCliWorkerConfig(), opt);
    }
    /**
     * path to file where config is stored
     */
    pathToFile;
    /**
     * port taken by service
     */
    port;
    /**
     * unique in whole system id of service
     */
    serviceID;
    /**
     * pid of service process
     */
    pid;
    /**
     * timestamp when service was started
     * (in other cases = null)
     */
    startTimestamp;
    /**
     * version
     */
    version;
    hasBiggerOrEqualWorkerVersionThan(other) {
        //#region @backendFunc
        other = BaseCliWorkerConfig.from(other);
        if (this.serviceID !== other.serviceID) {
            return false;
        }
        if (!this.version || !other.version) {
            false;
        }
        try {
            return gte(this.version, other.version);
        }
        catch (error) {
            return false;
        }
        //#endregion
    }
    isEquals(other) {
        other = BaseCliWorkerConfig.from(other);
        return (!!this.serviceID &&
            !!this.port &&
            !!this.pid &&
            this.serviceID === other.serviceID &&
            this.port === other.port &&
            this.pid === other.pid);
    }
    get isEmpty() {
        return !this.serviceID && !this.port && !this.pid;
    }
}
//#endregion
//# sourceMappingURL=c:/Users/darek/projects/npm/taon-dev/tnp-helpers/dist-nocutsrc-prod/lib/base/classes/base-cli-worker/base-cli-worker-config.js.map