/*
 * SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software. 
 * This class is generated using the converter UniSharping (www.unisharping.ru) from Pullenti C# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */


const UpdateCommand = require("./UpdateCommand");
const ZipEntry = require("./ZipEntry");

class ZipUpdate {
    
    constructor(_entry, _command = UpdateCommand.ADD, dataSource = null, fileName = null, str = null) {
        this.entry_ = null;
        this.outEntry_ = null;
        this.command_ = UpdateCommand.COPY;
        this.dataSource_ = null;
        this._stream = null;
        this.filename_ = null;
        this.sizePatchOffset_ = -1;
        this.crcPatchOffset_ = -1;
        this._offsetBasedSize = -1;
        this.dataSource_ = dataSource;
        this.filename_ = fileName;
        this.command_ = _command;
        this._stream = str;
        this.entry_ = _entry.clone();
    }
    
    get entry() {
        return this.entry_;
    }
    
    get outEntry() {
        if (this.outEntry_ === null) 
            this.outEntry_ = this.entry_.clone();
        return this.outEntry_;
    }
    
    get command() {
        return this.command_;
    }
    
    get filename() {
        return this.filename_;
    }
    
    get sizePatchOffset() {
        return this.sizePatchOffset_;
    }
    set sizePatchOffset(value) {
        this.sizePatchOffset_ = value;
        return value;
    }
    
    get crcPatchOffset() {
        return this.crcPatchOffset_;
    }
    set crcPatchOffset(value) {
        this.crcPatchOffset_ = value;
        return value;
    }
    
    get offsetBasedSize() {
        return this._offsetBasedSize;
    }
    set offsetBasedSize(value) {
        this._offsetBasedSize = value;
        return value;
    }
    
    getSource() {
        if (this._stream !== null) 
            return this._stream;
        let result = null;
        if (this.dataSource_ !== null) 
            result = this.dataSource_.getSource();
        return result;
    }
}


module.exports = ZipUpdate