// 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";

export enum ContentType {
    /**
     * The Go zero value for the underlying type of the enum.
     */
    $zero = "",

    ContentTypeFile = "file",
    ContentTypeText = "text",
    ContentTypeFolder = "folder",
};

/**
 * Progress 用户前端传输进度
 */
export class Progress {
    /**
     * 当前进度
     */
    "current": number;

    /**
     * 总进度
     */
    "total": number;

    /**
     * 速度
     */
    "speed": number;

    /** Creates a new Progress instance. */
    constructor($$source: Partial<Progress> = {}) {
        if (!("current" in $$source)) {
            this["current"] = 0;
        }
        if (!("total" in $$source)) {
            this["total"] = 0;
        }
        if (!("speed" in $$source)) {
            this["speed"] = 0;
        }

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

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

export class Sender {
    /**
     * 发送者 ID
     */
    "id": string;

    /**
     * 发送者名称
     */
    "name": string;

    /** Creates a new Sender instance. */
    constructor($$source: Partial<Sender> = {}) {
        if (!("id" in $$source)) {
            this["id"] = "";
        }
        if (!("name" in $$source)) {
            this["name"] = "";
        }

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

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

/**
 * Transfer
 */
export class Transfer {
    /**
     * 传输会话 ID
     */
    "id": string;

    /**
     * 发送者
     */
    "sender": Sender;

    /**
     * 文件名
     */
    "file_name": string;

    /**
     * 文件大小 (字节)
     */
    "file_size": number;

    /**
     * 保存路径
     */
    "savePath": string;

    /**
     * 传输状态
     */
    "status": TransferStatus;

    /**
     * 传输进度
     */
    "progress": Progress;

    /**
     * 进度类型
     */
    "type": TransferType;

    /**
     * 内容类型
     */
    "content_type": ContentType;

    /**
     * 文本内容
     */
    "text": string;

    /**
     * 错误信息
     */
    "error_msg": string;

    /**
     * 用于上传的凭证
     */
    "token": string;

    /** Creates a new Transfer instance. */
    constructor($$source: Partial<Transfer> = {}) {
        if (!("id" in $$source)) {
            this["id"] = "";
        }
        if (!("sender" in $$source)) {
            this["sender"] = (new Sender());
        }
        if (!("file_name" in $$source)) {
            this["file_name"] = "";
        }
        if (!("file_size" in $$source)) {
            this["file_size"] = 0;
        }
        if (!("savePath" in $$source)) {
            this["savePath"] = "";
        }
        if (!("status" in $$source)) {
            this["status"] = TransferStatus.$zero;
        }
        if (!("progress" in $$source)) {
            this["progress"] = (new Progress());
        }
        if (!("type" in $$source)) {
            this["type"] = TransferType.$zero;
        }
        if (!("content_type" in $$source)) {
            this["content_type"] = ContentType.$zero;
        }
        if (!("text" in $$source)) {
            this["text"] = "";
        }
        if (!("error_msg" in $$source)) {
            this["error_msg"] = "";
        }
        if (!("token" in $$source)) {
            this["token"] = "";
        }

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

    /**
     * Creates a new Transfer instance from a string or object.
     */
    static createFrom($$source: any = {}): Transfer {
        const $$createField1_0 = $$createType0;
        const $$createField6_0 = $$createType1;
        let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
        if ("sender" in $$parsedSource) {
            $$parsedSource["sender"] = $$createField1_0($$parsedSource["sender"]);
        }
        if ("progress" in $$parsedSource) {
            $$parsedSource["progress"] = $$createField6_0($$parsedSource["progress"]);
        }
        return new Transfer($$parsedSource as Partial<Transfer>);
    }
}

export enum TransferStatus {
    /**
     * The Go zero value for the underlying type of the enum.
     */
    $zero = "",

    TransferStatusPending = "pending",
    TransferStatusAccepted = "accepted",
    TransferStatusRejected = "rejected",
    TransferStatusCompleted = "completed",
    TransferStatusError = "error",
    TransferStatusCanceled = "canceled",
    TransferStatusActive = "active",
};

export enum TransferType {
    /**
     * The Go zero value for the underlying type of the enum.
     */
    $zero = "",

    TransferTypeSend = "send",
    TransferTypeReceive = "receive",
};

// Private type creation functions
const $$createType0 = Sender.createFrom;
const $$createType1 = Progress.createFrom;
