// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Create as $Create } from "@wailsio/runtime";

/**
 * FileOperationResult 文件操作结果
 */
export class FileOperationResult {
    "path": string;
    "name": string;
    "size": number;
    "size_str"?: string;
    "is_dir": boolean;
    "mod_time"?: string;
    "mode"?: string;

    /**
     * 仅重命名操作时有值
     */
    "old_path"?: string;

    /**
     * 仅删除操作时有值
     */
    "deleted"?: boolean;

    /** Creates a new FileOperationResult instance. */
    constructor($$source: Partial<FileOperationResult> = {}) {
        if (!("path" in $$source)) {
            this["path"] = "";
        }
        if (!("name" in $$source)) {
            this["name"] = "";
        }
        if (!("size" in $$source)) {
            this["size"] = 0;
        }
        if (!("is_dir" in $$source)) {
            this["is_dir"] = false;
        }

        Object.assign(this, $$source);
    }

    /**
     * Creates a new FileOperationResult instance from a string or object.
     */
    static createFrom($$source: any = {}): FileOperationResult {
        let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
        return new FileOperationResult($$parsedSource as Partial<FileOperationResult>);
    }
}
