/**
 * #linksandcomments_msg.ts
 *
 * Code generated by ts-proto. DO NOT EDIT.
 * @packageDocumentation
 */
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal.js";
import { Any } from "../../../../google/protobuf/any.js";
import { ListValue } from "../../../../google/protobuf/struct.js";
import { BoolValue, Int32Value, StringValue } from "../../../../google/protobuf/wrappers.js";
import { CustomPostStyles, entrypointHeightFromJSON, entrypointHeightToJSON, } from "../../../../reddit/devvit/post/v1/post.js";
import { messageTypeRegistry } from "../../../../typeRegistry.js";
import { Comment } from "../../../reddit/comment.js";
import { DevvitPostData } from "../../../ui/effects/web_view/v1alpha/context.js";
import { highlightedPostLabelFromJSON, highlightedPostLabelToJSON, runAsFromJSON, runAsToJSON, UserGeneratedContent, } from "../common/common_msg.js";
export var SetCustomPostPreviewRequest_BodyType;
(function (SetCustomPostPreviewRequest_BodyType) {
    /** UNKNOWN - Default value. Should not be used for requests. */
    SetCustomPostPreviewRequest_BodyType[SetCustomPostPreviewRequest_BodyType["UNKNOWN"] = 0] = "UNKNOWN";
    /** BLOCKS - Body is a Blocks rendering, and should be present in `blocks_render_content`. */
    SetCustomPostPreviewRequest_BodyType[SetCustomPostPreviewRequest_BodyType["BLOCKS"] = 1] = "BLOCKS";
    SetCustomPostPreviewRequest_BodyType[SetCustomPostPreviewRequest_BodyType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(SetCustomPostPreviewRequest_BodyType || (SetCustomPostPreviewRequest_BodyType = {}));
export function setCustomPostPreviewRequest_BodyTypeFromJSON(object) {
    switch (object) {
        case 0:
        case "UNKNOWN":
            return SetCustomPostPreviewRequest_BodyType.UNKNOWN;
        case 1:
        case "BLOCKS":
            return SetCustomPostPreviewRequest_BodyType.BLOCKS;
        case -1:
        case "UNRECOGNIZED":
        default:
            return SetCustomPostPreviewRequest_BodyType.UNRECOGNIZED;
    }
}
export function setCustomPostPreviewRequest_BodyTypeToJSON(object) {
    switch (object) {
        case SetCustomPostPreviewRequest_BodyType.UNKNOWN:
            return 0;
        case SetCustomPostPreviewRequest_BodyType.BLOCKS:
            return 1;
        case SetCustomPostPreviewRequest_BodyType.UNRECOGNIZED:
        default:
            return -1;
    }
}
function createBaseCommentRequest() {
    return { richtextJson: undefined, text: "", thingId: "", runAs: 0 };
}
export const CommentRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.CommentRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.richtextJson !== undefined) {
            StringValue.encode({ value: message.richtextJson }, writer.uint32(10).fork()).ldelim();
        }
        if (message.text !== "") {
            writer.uint32(18).string(message.text);
        }
        if (message.thingId !== "") {
            writer.uint32(26).string(message.thingId);
        }
        if (message.runAs !== 0) {
            writer.uint32(32).int32(message.runAs);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseCommentRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.richtextJson = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.text = reader.string();
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.thingId = reader.string();
                    continue;
                case 4:
                    if (tag !== 32) {
                        break;
                    }
                    message.runAs = reader.int32();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            richtextJson: isSet(object.richtextJson) ? String(object.richtextJson) : undefined,
            text: isSet(object.text) ? globalThis.String(object.text) : "",
            thingId: isSet(object.thingId) ? globalThis.String(object.thingId) : "",
            runAs: isSet(object.runAs) ? runAsFromJSON(object.runAs) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.richtextJson !== undefined) {
            obj.richtextJson = message.richtextJson;
        }
        if (message.text !== "") {
            obj.text = message.text;
        }
        if (message.thingId !== "") {
            obj.thingId = message.thingId;
        }
        if (message.runAs !== 0) {
            obj.runAs = runAsToJSON(message.runAs);
        }
        return obj;
    },
    create(base) {
        return CommentRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseCommentRequest();
        message.richtextJson = object.richtextJson ?? undefined;
        message.text = object.text ?? "";
        message.thingId = object.thingId ?? "";
        message.runAs = object.runAs ?? 0;
        return message;
    },
};
messageTypeRegistry.set(CommentRequest.$type, CommentRequest);
function createBaseFollowPostRequest() {
    return { follow: false, fullname: "" };
}
export const FollowPostRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.FollowPostRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.follow !== false) {
            writer.uint32(8).bool(message.follow);
        }
        if (message.fullname !== "") {
            writer.uint32(18).string(message.fullname);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseFollowPostRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 8) {
                        break;
                    }
                    message.follow = reader.bool();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.fullname = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            follow: isSet(object.follow) ? globalThis.Boolean(object.follow) : false,
            fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.follow !== false) {
            obj.follow = message.follow;
        }
        if (message.fullname !== "") {
            obj.fullname = message.fullname;
        }
        return obj;
    },
    create(base) {
        return FollowPostRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseFollowPostRequest();
        message.follow = object.follow ?? false;
        message.fullname = object.fullname ?? "";
        return message;
    },
};
messageTypeRegistry.set(FollowPostRequest.$type, FollowPostRequest);
function createBaseBasicIdRequest() {
    return { id: "" };
}
export const BasicIdRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.BasicIdRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseBasicIdRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { id: isSet(object.id) ? globalThis.String(object.id) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        return obj;
    },
    create(base) {
        return BasicIdRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseBasicIdRequest();
        message.id = object.id ?? "";
        return message;
    },
};
messageTypeRegistry.set(BasicIdRequest.$type, BasicIdRequest);
function createBaseInfoRequest() {
    return { subreddits: [], thingIds: [], url: undefined };
}
export const InfoRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.InfoRequest",
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.subreddits) {
            writer.uint32(10).string(v);
        }
        for (const v of message.thingIds) {
            writer.uint32(18).string(v);
        }
        if (message.url !== undefined) {
            StringValue.encode({ value: message.url }, writer.uint32(26).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseInfoRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.subreddits.push(reader.string());
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.thingIds.push(reader.string());
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.url = StringValue.decode(reader, reader.uint32()).value;
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            subreddits: globalThis.Array.isArray(object?.subreddits)
                ? object.subreddits.map((e) => globalThis.String(e))
                : [],
            thingIds: globalThis.Array.isArray(object?.thingIds) ? object.thingIds.map((e) => globalThis.String(e)) : [],
            url: isSet(object.url) ? String(object.url) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.subreddits?.length) {
            obj.subreddits = message.subreddits;
        }
        if (message.thingIds?.length) {
            obj.thingIds = message.thingIds;
        }
        if (message.url !== undefined) {
            obj.url = message.url;
        }
        return obj;
    },
    create(base) {
        return InfoRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseInfoRequest();
        message.subreddits = object.subreddits?.map((e) => e) || [];
        message.thingIds = object.thingIds?.map((e) => e) || [];
        message.url = object.url ?? undefined;
        return message;
    },
};
messageTypeRegistry.set(InfoRequest.$type, InfoRequest);
function createBaseMoreChildrenRequest() {
    return { children: [], depth: undefined, limitChildren: undefined, linkId: "", sort: undefined, id: undefined };
}
export const MoreChildrenRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.MoreChildrenRequest",
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.children) {
            writer.uint32(10).string(v);
        }
        if (message.depth !== undefined) {
            Int32Value.encode({ value: message.depth }, writer.uint32(18).fork()).ldelim();
        }
        if (message.limitChildren !== undefined) {
            BoolValue.encode({ value: message.limitChildren }, writer.uint32(34).fork()).ldelim();
        }
        if (message.linkId !== "") {
            writer.uint32(42).string(message.linkId);
        }
        if (message.sort !== undefined) {
            StringValue.encode({ value: message.sort }, writer.uint32(50).fork()).ldelim();
        }
        if (message.id !== undefined) {
            StringValue.encode({ value: message.id }, writer.uint32(58).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseMoreChildrenRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.children.push(reader.string());
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.depth = Int32Value.decode(reader, reader.uint32()).value;
                    continue;
                case 4:
                    if (tag !== 34) {
                        break;
                    }
                    message.limitChildren = BoolValue.decode(reader, reader.uint32()).value;
                    continue;
                case 5:
                    if (tag !== 42) {
                        break;
                    }
                    message.linkId = reader.string();
                    continue;
                case 6:
                    if (tag !== 50) {
                        break;
                    }
                    message.sort = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 7:
                    if (tag !== 58) {
                        break;
                    }
                    message.id = StringValue.decode(reader, reader.uint32()).value;
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            children: globalThis.Array.isArray(object?.children) ? object.children.map((e) => globalThis.String(e)) : [],
            depth: isSet(object.depth) ? Number(object.depth) : undefined,
            limitChildren: isSet(object.limitChildren) ? Boolean(object.limitChildren) : undefined,
            linkId: isSet(object.linkId) ? globalThis.String(object.linkId) : "",
            sort: isSet(object.sort) ? String(object.sort) : undefined,
            id: isSet(object.id) ? String(object.id) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.children?.length) {
            obj.children = message.children;
        }
        if (message.depth !== undefined) {
            obj.depth = message.depth;
        }
        if (message.limitChildren !== undefined) {
            obj.limitChildren = message.limitChildren;
        }
        if (message.linkId !== "") {
            obj.linkId = message.linkId;
        }
        if (message.sort !== undefined) {
            obj.sort = message.sort;
        }
        if (message.id !== undefined) {
            obj.id = message.id;
        }
        return obj;
    },
    create(base) {
        return MoreChildrenRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseMoreChildrenRequest();
        message.children = object.children?.map((e) => e) || [];
        message.depth = object.depth ?? undefined;
        message.limitChildren = object.limitChildren ?? undefined;
        message.linkId = object.linkId ?? "";
        message.sort = object.sort ?? undefined;
        message.id = object.id ?? undefined;
        return message;
    },
};
messageTypeRegistry.set(MoreChildrenRequest.$type, MoreChildrenRequest);
function createBaseReportRequest() {
    return {
        additionalInfo: undefined,
        customText: undefined,
        modmailConvId: undefined,
        otherReason: undefined,
        reason: "",
        ruleReason: undefined,
        siteReason: undefined,
        srName: undefined,
        thingId: "",
        usernames: undefined,
    };
}
export const ReportRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.ReportRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.additionalInfo !== undefined) {
            StringValue.encode({ value: message.additionalInfo }, writer.uint32(10).fork()).ldelim();
        }
        if (message.customText !== undefined) {
            StringValue.encode({ value: message.customText }, writer.uint32(18).fork()).ldelim();
        }
        if (message.modmailConvId !== undefined) {
            StringValue.encode({ value: message.modmailConvId }, writer.uint32(42).fork()).ldelim();
        }
        if (message.otherReason !== undefined) {
            StringValue.encode({ value: message.otherReason }, writer.uint32(50).fork()).ldelim();
        }
        if (message.reason !== "") {
            writer.uint32(58).string(message.reason);
        }
        if (message.ruleReason !== undefined) {
            StringValue.encode({ value: message.ruleReason }, writer.uint32(66).fork()).ldelim();
        }
        if (message.siteReason !== undefined) {
            StringValue.encode({ value: message.siteReason }, writer.uint32(74).fork()).ldelim();
        }
        if (message.srName !== undefined) {
            StringValue.encode({ value: message.srName }, writer.uint32(82).fork()).ldelim();
        }
        if (message.thingId !== "") {
            writer.uint32(90).string(message.thingId);
        }
        if (message.usernames !== undefined) {
            StringValue.encode({ value: message.usernames }, writer.uint32(98).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseReportRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.additionalInfo = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.customText = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 5:
                    if (tag !== 42) {
                        break;
                    }
                    message.modmailConvId = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 6:
                    if (tag !== 50) {
                        break;
                    }
                    message.otherReason = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 7:
                    if (tag !== 58) {
                        break;
                    }
                    message.reason = reader.string();
                    continue;
                case 8:
                    if (tag !== 66) {
                        break;
                    }
                    message.ruleReason = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 9:
                    if (tag !== 74) {
                        break;
                    }
                    message.siteReason = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 10:
                    if (tag !== 82) {
                        break;
                    }
                    message.srName = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 11:
                    if (tag !== 90) {
                        break;
                    }
                    message.thingId = reader.string();
                    continue;
                case 12:
                    if (tag !== 98) {
                        break;
                    }
                    message.usernames = StringValue.decode(reader, reader.uint32()).value;
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            additionalInfo: isSet(object.additionalInfo) ? String(object.additionalInfo) : undefined,
            customText: isSet(object.customText) ? String(object.customText) : undefined,
            modmailConvId: isSet(object.modmailConvId) ? String(object.modmailConvId) : undefined,
            otherReason: isSet(object.otherReason) ? String(object.otherReason) : undefined,
            reason: isSet(object.reason) ? globalThis.String(object.reason) : "",
            ruleReason: isSet(object.ruleReason) ? String(object.ruleReason) : undefined,
            siteReason: isSet(object.siteReason) ? String(object.siteReason) : undefined,
            srName: isSet(object.srName) ? String(object.srName) : undefined,
            thingId: isSet(object.thingId) ? globalThis.String(object.thingId) : "",
            usernames: isSet(object.usernames) ? String(object.usernames) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.additionalInfo !== undefined) {
            obj.additionalInfo = message.additionalInfo;
        }
        if (message.customText !== undefined) {
            obj.customText = message.customText;
        }
        if (message.modmailConvId !== undefined) {
            obj.modmailConvId = message.modmailConvId;
        }
        if (message.otherReason !== undefined) {
            obj.otherReason = message.otherReason;
        }
        if (message.reason !== "") {
            obj.reason = message.reason;
        }
        if (message.ruleReason !== undefined) {
            obj.ruleReason = message.ruleReason;
        }
        if (message.siteReason !== undefined) {
            obj.siteReason = message.siteReason;
        }
        if (message.srName !== undefined) {
            obj.srName = message.srName;
        }
        if (message.thingId !== "") {
            obj.thingId = message.thingId;
        }
        if (message.usernames !== undefined) {
            obj.usernames = message.usernames;
        }
        return obj;
    },
    create(base) {
        return ReportRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseReportRequest();
        message.additionalInfo = object.additionalInfo ?? undefined;
        message.customText = object.customText ?? undefined;
        message.modmailConvId = object.modmailConvId ?? undefined;
        message.otherReason = object.otherReason ?? undefined;
        message.reason = object.reason ?? "";
        message.ruleReason = object.ruleReason ?? undefined;
        message.siteReason = object.siteReason ?? undefined;
        message.srName = object.srName ?? undefined;
        message.thingId = object.thingId ?? "";
        message.usernames = object.usernames ?? undefined;
        return message;
    },
};
messageTypeRegistry.set(ReportRequest.$type, ReportRequest);
function createBaseReportAwardRequest() {
    return { awardId: "", reason: undefined };
}
export const ReportAwardRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.ReportAwardRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.awardId !== "") {
            writer.uint32(10).string(message.awardId);
        }
        if (message.reason !== undefined) {
            StringValue.encode({ value: message.reason }, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseReportAwardRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.awardId = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.reason = StringValue.decode(reader, reader.uint32()).value;
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            awardId: isSet(object.awardId) ? globalThis.String(object.awardId) : "",
            reason: isSet(object.reason) ? String(object.reason) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.awardId !== "") {
            obj.awardId = message.awardId;
        }
        if (message.reason !== undefined) {
            obj.reason = message.reason;
        }
        return obj;
    },
    create(base) {
        return ReportAwardRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseReportAwardRequest();
        message.awardId = object.awardId ?? "";
        message.reason = object.reason ?? undefined;
        return message;
    },
};
messageTypeRegistry.set(ReportAwardRequest.$type, ReportAwardRequest);
function createBaseSaveRequest() {
    return { id: "" };
}
export const SaveRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.SaveRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSaveRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { id: isSet(object.id) ? globalThis.String(object.id) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        return obj;
    },
    create(base) {
        return SaveRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSaveRequest();
        message.id = object.id ?? "";
        return message;
    },
};
messageTypeRegistry.set(SaveRequest.$type, SaveRequest);
function createBaseSendRepliesRequest() {
    return { id: "", state: false };
}
export const SendRepliesRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.SendRepliesRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        if (message.state !== false) {
            writer.uint32(16).bool(message.state);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSendRepliesRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
                case 2:
                    if (tag !== 16) {
                        break;
                    }
                    message.state = reader.bool();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            id: isSet(object.id) ? globalThis.String(object.id) : "",
            state: isSet(object.state) ? globalThis.Boolean(object.state) : false,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        if (message.state !== false) {
            obj.state = message.state;
        }
        return obj;
    },
    create(base) {
        return SendRepliesRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSendRepliesRequest();
        message.id = object.id ?? "";
        message.state = object.state ?? false;
        return message;
    },
};
messageTypeRegistry.set(SendRepliesRequest.$type, SendRepliesRequest);
function createBaseSetContestModeRequest() {
    return { id: "", state: false };
}
export const SetContestModeRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.SetContestModeRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        if (message.state !== false) {
            writer.uint32(16).bool(message.state);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSetContestModeRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
                case 2:
                    if (tag !== 16) {
                        break;
                    }
                    message.state = reader.bool();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            id: isSet(object.id) ? globalThis.String(object.id) : "",
            state: isSet(object.state) ? globalThis.Boolean(object.state) : false,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        if (message.state !== false) {
            obj.state = message.state;
        }
        return obj;
    },
    create(base) {
        return SetContestModeRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSetContestModeRequest();
        message.id = object.id ?? "";
        message.state = object.state ?? false;
        return message;
    },
};
messageTypeRegistry.set(SetContestModeRequest.$type, SetContestModeRequest);
function createBaseSetSubredditStickyRequest() {
    return { id: "", num: undefined, state: false, toProfile: undefined };
}
export const SetSubredditStickyRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.SetSubredditStickyRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        if (message.num !== undefined) {
            Int32Value.encode({ value: message.num }, writer.uint32(18).fork()).ldelim();
        }
        if (message.state !== false) {
            writer.uint32(24).bool(message.state);
        }
        if (message.toProfile !== undefined) {
            BoolValue.encode({ value: message.toProfile }, writer.uint32(34).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSetSubredditStickyRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.num = Int32Value.decode(reader, reader.uint32()).value;
                    continue;
                case 3:
                    if (tag !== 24) {
                        break;
                    }
                    message.state = reader.bool();
                    continue;
                case 4:
                    if (tag !== 34) {
                        break;
                    }
                    message.toProfile = BoolValue.decode(reader, reader.uint32()).value;
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            id: isSet(object.id) ? globalThis.String(object.id) : "",
            num: isSet(object.num) ? Number(object.num) : undefined,
            state: isSet(object.state) ? globalThis.Boolean(object.state) : false,
            toProfile: isSet(object.toProfile) ? Boolean(object.toProfile) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        if (message.num !== undefined) {
            obj.num = message.num;
        }
        if (message.state !== false) {
            obj.state = message.state;
        }
        if (message.toProfile !== undefined) {
            obj.toProfile = message.toProfile;
        }
        return obj;
    },
    create(base) {
        return SetSubredditStickyRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSetSubredditStickyRequest();
        message.id = object.id ?? "";
        message.num = object.num ?? undefined;
        message.state = object.state ?? false;
        message.toProfile = object.toProfile ?? undefined;
        return message;
    },
};
messageTypeRegistry.set(SetSubredditStickyRequest.$type, SetSubredditStickyRequest);
function createBaseSetSuggestedSortRequest() {
    return { id: "", sort: "" };
}
export const SetSuggestedSortRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.SetSuggestedSortRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        if (message.sort !== "") {
            writer.uint32(18).string(message.sort);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSetSuggestedSortRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.sort = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            id: isSet(object.id) ? globalThis.String(object.id) : "",
            sort: isSet(object.sort) ? globalThis.String(object.sort) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        if (message.sort !== "") {
            obj.sort = message.sort;
        }
        return obj;
    },
    create(base) {
        return SetSuggestedSortRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSetSuggestedSortRequest();
        message.id = object.id ?? "";
        message.sort = object.sort ?? "";
        return message;
    },
};
messageTypeRegistry.set(SetSuggestedSortRequest.$type, SetSuggestedSortRequest);
function createBaseSubmitRequest() {
    return {
        collectionId: undefined,
        flairId: undefined,
        flairText: undefined,
        kind: "",
        nsfw: undefined,
        richtextJson: undefined,
        sendreplies: undefined,
        spoiler: undefined,
        sr: "",
        text: undefined,
        title: "",
        url: undefined,
        videoPosterUrl: undefined,
        crosspostFullname: undefined,
        richtextFallback: undefined,
        imageUrls: undefined,
        runAs: 0,
        userGeneratedContent: undefined,
        postData: undefined,
        customPostStyles: undefined,
    };
}
export const SubmitRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.SubmitRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.collectionId !== undefined) {
            StringValue.encode({ value: message.collectionId }, writer.uint32(18).fork()).ldelim();
        }
        if (message.flairId !== undefined) {
            StringValue.encode({ value: message.flairId }, writer.uint32(58).fork()).ldelim();
        }
        if (message.flairText !== undefined) {
            StringValue.encode({ value: message.flairText }, writer.uint32(66).fork()).ldelim();
        }
        if (message.kind !== "") {
            writer.uint32(74).string(message.kind);
        }
        if (message.nsfw !== undefined) {
            BoolValue.encode({ value: message.nsfw }, writer.uint32(82).fork()).ldelim();
        }
        if (message.richtextJson !== undefined) {
            StringValue.encode({ value: message.richtextJson }, writer.uint32(98).fork()).ldelim();
        }
        if (message.sendreplies !== undefined) {
            BoolValue.encode({ value: message.sendreplies }, writer.uint32(106).fork()).ldelim();
        }
        if (message.spoiler !== undefined) {
            BoolValue.encode({ value: message.spoiler }, writer.uint32(114).fork()).ldelim();
        }
        if (message.sr !== "") {
            writer.uint32(122).string(message.sr);
        }
        if (message.text !== undefined) {
            StringValue.encode({ value: message.text }, writer.uint32(130).fork()).ldelim();
        }
        if (message.title !== "") {
            writer.uint32(138).string(message.title);
        }
        if (message.url !== undefined) {
            StringValue.encode({ value: message.url }, writer.uint32(146).fork()).ldelim();
        }
        if (message.videoPosterUrl !== undefined) {
            StringValue.encode({ value: message.videoPosterUrl }, writer.uint32(154).fork()).ldelim();
        }
        if (message.crosspostFullname !== undefined) {
            StringValue.encode({ value: message.crosspostFullname }, writer.uint32(162).fork()).ldelim();
        }
        if (message.richtextFallback !== undefined) {
            StringValue.encode({ value: message.richtextFallback }, writer.uint32(170).fork()).ldelim();
        }
        if (message.imageUrls !== undefined) {
            ListValue.encode(ListValue.wrap(message.imageUrls), writer.uint32(178).fork()).ldelim();
        }
        if (message.runAs !== 0) {
            writer.uint32(184).int32(message.runAs);
        }
        if (message.userGeneratedContent !== undefined) {
            UserGeneratedContent.encode(message.userGeneratedContent, writer.uint32(194).fork()).ldelim();
        }
        if (message.postData !== undefined) {
            DevvitPostData.encode(message.postData, writer.uint32(202).fork()).ldelim();
        }
        if (message.customPostStyles !== undefined) {
            CustomPostStyles.encode(message.customPostStyles, writer.uint32(210).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSubmitRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.collectionId = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 7:
                    if (tag !== 58) {
                        break;
                    }
                    message.flairId = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 8:
                    if (tag !== 66) {
                        break;
                    }
                    message.flairText = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 9:
                    if (tag !== 74) {
                        break;
                    }
                    message.kind = reader.string();
                    continue;
                case 10:
                    if (tag !== 82) {
                        break;
                    }
                    message.nsfw = BoolValue.decode(reader, reader.uint32()).value;
                    continue;
                case 12:
                    if (tag !== 98) {
                        break;
                    }
                    message.richtextJson = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 13:
                    if (tag !== 106) {
                        break;
                    }
                    message.sendreplies = BoolValue.decode(reader, reader.uint32()).value;
                    continue;
                case 14:
                    if (tag !== 114) {
                        break;
                    }
                    message.spoiler = BoolValue.decode(reader, reader.uint32()).value;
                    continue;
                case 15:
                    if (tag !== 122) {
                        break;
                    }
                    message.sr = reader.string();
                    continue;
                case 16:
                    if (tag !== 130) {
                        break;
                    }
                    message.text = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 17:
                    if (tag !== 138) {
                        break;
                    }
                    message.title = reader.string();
                    continue;
                case 18:
                    if (tag !== 146) {
                        break;
                    }
                    message.url = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 19:
                    if (tag !== 154) {
                        break;
                    }
                    message.videoPosterUrl = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 20:
                    if (tag !== 162) {
                        break;
                    }
                    message.crosspostFullname = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 21:
                    if (tag !== 170) {
                        break;
                    }
                    message.richtextFallback = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 22:
                    if (tag !== 178) {
                        break;
                    }
                    message.imageUrls = ListValue.unwrap(ListValue.decode(reader, reader.uint32()));
                    continue;
                case 23:
                    if (tag !== 184) {
                        break;
                    }
                    message.runAs = reader.int32();
                    continue;
                case 24:
                    if (tag !== 194) {
                        break;
                    }
                    message.userGeneratedContent = UserGeneratedContent.decode(reader, reader.uint32());
                    continue;
                case 25:
                    if (tag !== 202) {
                        break;
                    }
                    message.postData = DevvitPostData.decode(reader, reader.uint32());
                    continue;
                case 26:
                    if (tag !== 210) {
                        break;
                    }
                    message.customPostStyles = CustomPostStyles.decode(reader, reader.uint32());
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            collectionId: isSet(object.collectionId) ? String(object.collectionId) : undefined,
            flairId: isSet(object.flairId) ? String(object.flairId) : undefined,
            flairText: isSet(object.flairText) ? String(object.flairText) : undefined,
            kind: isSet(object.kind) ? globalThis.String(object.kind) : "",
            nsfw: isSet(object.nsfw) ? Boolean(object.nsfw) : undefined,
            richtextJson: isSet(object.richtextJson) ? String(object.richtextJson) : undefined,
            sendreplies: isSet(object.sendreplies) ? Boolean(object.sendreplies) : undefined,
            spoiler: isSet(object.spoiler) ? Boolean(object.spoiler) : undefined,
            sr: isSet(object.sr) ? globalThis.String(object.sr) : "",
            text: isSet(object.text) ? String(object.text) : undefined,
            title: isSet(object.title) ? globalThis.String(object.title) : "",
            url: isSet(object.url) ? String(object.url) : undefined,
            videoPosterUrl: isSet(object.videoPosterUrl) ? String(object.videoPosterUrl) : undefined,
            crosspostFullname: isSet(object.crosspostFullname) ? String(object.crosspostFullname) : undefined,
            richtextFallback: isSet(object.richtextFallback) ? String(object.richtextFallback) : undefined,
            imageUrls: globalThis.Array.isArray(object.imageUrls) ? [...object.imageUrls] : undefined,
            runAs: isSet(object.runAs) ? runAsFromJSON(object.runAs) : 0,
            userGeneratedContent: isSet(object.userGeneratedContent)
                ? UserGeneratedContent.fromJSON(object.userGeneratedContent)
                : undefined,
            postData: isSet(object.postData) ? DevvitPostData.fromJSON(object.postData) : undefined,
            customPostStyles: isSet(object.customPostStyles) ? CustomPostStyles.fromJSON(object.customPostStyles) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.collectionId !== undefined) {
            obj.collectionId = message.collectionId;
        }
        if (message.flairId !== undefined) {
            obj.flairId = message.flairId;
        }
        if (message.flairText !== undefined) {
            obj.flairText = message.flairText;
        }
        if (message.kind !== "") {
            obj.kind = message.kind;
        }
        if (message.nsfw !== undefined) {
            obj.nsfw = message.nsfw;
        }
        if (message.richtextJson !== undefined) {
            obj.richtextJson = message.richtextJson;
        }
        if (message.sendreplies !== undefined) {
            obj.sendreplies = message.sendreplies;
        }
        if (message.spoiler !== undefined) {
            obj.spoiler = message.spoiler;
        }
        if (message.sr !== "") {
            obj.sr = message.sr;
        }
        if (message.text !== undefined) {
            obj.text = message.text;
        }
        if (message.title !== "") {
            obj.title = message.title;
        }
        if (message.url !== undefined) {
            obj.url = message.url;
        }
        if (message.videoPosterUrl !== undefined) {
            obj.videoPosterUrl = message.videoPosterUrl;
        }
        if (message.crosspostFullname !== undefined) {
            obj.crosspostFullname = message.crosspostFullname;
        }
        if (message.richtextFallback !== undefined) {
            obj.richtextFallback = message.richtextFallback;
        }
        if (message.imageUrls !== undefined) {
            obj.imageUrls = message.imageUrls;
        }
        if (message.runAs !== 0) {
            obj.runAs = runAsToJSON(message.runAs);
        }
        if (message.userGeneratedContent !== undefined) {
            obj.userGeneratedContent = UserGeneratedContent.toJSON(message.userGeneratedContent);
        }
        if (message.postData !== undefined) {
            obj.postData = DevvitPostData.toJSON(message.postData);
        }
        if (message.customPostStyles !== undefined) {
            obj.customPostStyles = CustomPostStyles.toJSON(message.customPostStyles);
        }
        return obj;
    },
    create(base) {
        return SubmitRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSubmitRequest();
        message.collectionId = object.collectionId ?? undefined;
        message.flairId = object.flairId ?? undefined;
        message.flairText = object.flairText ?? undefined;
        message.kind = object.kind ?? "";
        message.nsfw = object.nsfw ?? undefined;
        message.richtextJson = object.richtextJson ?? undefined;
        message.sendreplies = object.sendreplies ?? undefined;
        message.spoiler = object.spoiler ?? undefined;
        message.sr = object.sr ?? "";
        message.text = object.text ?? undefined;
        message.title = object.title ?? "";
        message.url = object.url ?? undefined;
        message.videoPosterUrl = object.videoPosterUrl ?? undefined;
        message.crosspostFullname = object.crosspostFullname ?? undefined;
        message.richtextFallback = object.richtextFallback ?? undefined;
        message.imageUrls = object.imageUrls ?? undefined;
        message.runAs = object.runAs ?? 0;
        message.userGeneratedContent = (object.userGeneratedContent !== undefined && object.userGeneratedContent !== null)
            ? UserGeneratedContent.fromPartial(object.userGeneratedContent)
            : undefined;
        message.postData = (object.postData !== undefined && object.postData !== null)
            ? DevvitPostData.fromPartial(object.postData)
            : undefined;
        message.customPostStyles = (object.customPostStyles !== undefined && object.customPostStyles !== null)
            ? CustomPostStyles.fromPartial(object.customPostStyles)
            : undefined;
        return message;
    },
};
messageTypeRegistry.set(SubmitRequest.$type, SubmitRequest);
function createBaseVoteRequest() {
    return { dir: 0, id: "" };
}
export const VoteRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.VoteRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.dir !== 0) {
            writer.uint32(8).int32(message.dir);
        }
        if (message.id !== "") {
            writer.uint32(18).string(message.id);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseVoteRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 8) {
                        break;
                    }
                    message.dir = reader.int32();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            dir: isSet(object.dir) ? globalThis.Number(object.dir) : 0,
            id: isSet(object.id) ? globalThis.String(object.id) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.dir !== 0) {
            obj.dir = Math.round(message.dir);
        }
        if (message.id !== "") {
            obj.id = message.id;
        }
        return obj;
    },
    create(base) {
        return VoteRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseVoteRequest();
        message.dir = object.dir ?? 0;
        message.id = object.id ?? "";
        return message;
    },
};
messageTypeRegistry.set(VoteRequest.$type, VoteRequest);
function createBaseEditCustomPostRequest() {
    return { thingId: "", richtextFallback: undefined, postData: undefined };
}
export const EditCustomPostRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.EditCustomPostRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.thingId !== "") {
            writer.uint32(10).string(message.thingId);
        }
        if (message.richtextFallback !== undefined) {
            StringValue.encode({ value: message.richtextFallback }, writer.uint32(18).fork()).ldelim();
        }
        if (message.postData !== undefined) {
            DevvitPostData.encode(message.postData, writer.uint32(26).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseEditCustomPostRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.thingId = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.richtextFallback = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.postData = DevvitPostData.decode(reader, reader.uint32());
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            thingId: isSet(object.thingId) ? globalThis.String(object.thingId) : "",
            richtextFallback: isSet(object.richtextFallback) ? String(object.richtextFallback) : undefined,
            postData: isSet(object.postData) ? DevvitPostData.fromJSON(object.postData) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.thingId !== "") {
            obj.thingId = message.thingId;
        }
        if (message.richtextFallback !== undefined) {
            obj.richtextFallback = message.richtextFallback;
        }
        if (message.postData !== undefined) {
            obj.postData = DevvitPostData.toJSON(message.postData);
        }
        return obj;
    },
    create(base) {
        return EditCustomPostRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseEditCustomPostRequest();
        message.thingId = object.thingId ?? "";
        message.richtextFallback = object.richtextFallback ?? undefined;
        message.postData = (object.postData !== undefined && object.postData !== null)
            ? DevvitPostData.fromPartial(object.postData)
            : undefined;
        return message;
    },
};
messageTypeRegistry.set(EditCustomPostRequest.$type, EditCustomPostRequest);
function createBaseSetCustomPostPreviewRequest() {
    return { thingId: "", bodyType: 0, blocksRenderContent: undefined };
}
export const SetCustomPostPreviewRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.SetCustomPostPreviewRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.thingId !== "") {
            writer.uint32(10).string(message.thingId);
        }
        if (message.bodyType !== 0) {
            writer.uint32(16).int32(message.bodyType);
        }
        if (message.blocksRenderContent !== undefined) {
            StringValue.encode({ value: message.blocksRenderContent }, writer.uint32(26).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSetCustomPostPreviewRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.thingId = reader.string();
                    continue;
                case 2:
                    if (tag !== 16) {
                        break;
                    }
                    message.bodyType = reader.int32();
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.blocksRenderContent = StringValue.decode(reader, reader.uint32()).value;
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            thingId: isSet(object.thingId) ? globalThis.String(object.thingId) : "",
            bodyType: isSet(object.bodyType) ? setCustomPostPreviewRequest_BodyTypeFromJSON(object.bodyType) : 0,
            blocksRenderContent: isSet(object.blocksRenderContent) ? String(object.blocksRenderContent) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.thingId !== "") {
            obj.thingId = message.thingId;
        }
        if (message.bodyType !== 0) {
            obj.bodyType = setCustomPostPreviewRequest_BodyTypeToJSON(message.bodyType);
        }
        if (message.blocksRenderContent !== undefined) {
            obj.blocksRenderContent = message.blocksRenderContent;
        }
        return obj;
    },
    create(base) {
        return SetCustomPostPreviewRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSetCustomPostPreviewRequest();
        message.thingId = object.thingId ?? "";
        message.bodyType = object.bodyType ?? 0;
        message.blocksRenderContent = object.blocksRenderContent ?? undefined;
        return message;
    },
};
messageTypeRegistry.set(SetCustomPostPreviewRequest.$type, SetCustomPostPreviewRequest);
function createBaseGetIsPostHighlightedRequest() {
    return { postId: "" };
}
export const GetIsPostHighlightedRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.GetIsPostHighlightedRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.postId !== "") {
            writer.uint32(10).string(message.postId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseGetIsPostHighlightedRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.postId = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { postId: isSet(object.postId) ? globalThis.String(object.postId) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.postId !== "") {
            obj.postId = message.postId;
        }
        return obj;
    },
    create(base) {
        return GetIsPostHighlightedRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseGetIsPostHighlightedRequest();
        message.postId = object.postId ?? "";
        return message;
    },
};
messageTypeRegistry.set(GetIsPostHighlightedRequest.$type, GetIsPostHighlightedRequest);
function createBaseAddPostToHighlightsRequest() {
    return { postId: "", expiresAt: undefined, label: undefined };
}
export const AddPostToHighlightsRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.AddPostToHighlightsRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.postId !== "") {
            writer.uint32(10).string(message.postId);
        }
        if (message.expiresAt !== undefined) {
            writer.uint32(16).int64(message.expiresAt);
        }
        if (message.label !== undefined) {
            writer.uint32(24).int32(message.label);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseAddPostToHighlightsRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.postId = reader.string();
                    continue;
                case 2:
                    if (tag !== 16) {
                        break;
                    }
                    message.expiresAt = longToNumber(reader.int64());
                    continue;
                case 3:
                    if (tag !== 24) {
                        break;
                    }
                    message.label = reader.int32();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            postId: isSet(object.postId) ? globalThis.String(object.postId) : "",
            expiresAt: isSet(object.expiresAt) ? globalThis.Number(object.expiresAt) : undefined,
            label: isSet(object.label) ? highlightedPostLabelFromJSON(object.label) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.postId !== "") {
            obj.postId = message.postId;
        }
        if (message.expiresAt !== undefined) {
            obj.expiresAt = Math.round(message.expiresAt);
        }
        if (message.label !== undefined) {
            obj.label = highlightedPostLabelToJSON(message.label);
        }
        return obj;
    },
    create(base) {
        return AddPostToHighlightsRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseAddPostToHighlightsRequest();
        message.postId = object.postId ?? "";
        message.expiresAt = object.expiresAt ?? undefined;
        message.label = object.label ?? undefined;
        return message;
    },
};
messageTypeRegistry.set(AddPostToHighlightsRequest.$type, AddPostToHighlightsRequest);
function createBaseRemovePostFromHighlightsRequest() {
    return { postId: "" };
}
export const RemovePostFromHighlightsRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.RemovePostFromHighlightsRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.postId !== "") {
            writer.uint32(10).string(message.postId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseRemovePostFromHighlightsRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.postId = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { postId: isSet(object.postId) ? globalThis.String(object.postId) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.postId !== "") {
            obj.postId = message.postId;
        }
        return obj;
    },
    create(base) {
        return RemovePostFromHighlightsRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseRemovePostFromHighlightsRequest();
        message.postId = object.postId ?? "";
        return message;
    },
};
messageTypeRegistry.set(RemovePostFromHighlightsRequest.$type, RemovePostFromHighlightsRequest);
function createBaseGetIsPostHighlightedResponse() {
    return { isHighlighted: false };
}
export const GetIsPostHighlightedResponse = {
    $type: "devvit.plugin.redditapi.linksandcomments.GetIsPostHighlightedResponse",
    encode(message, writer = _m0.Writer.create()) {
        if (message.isHighlighted !== false) {
            writer.uint32(8).bool(message.isHighlighted);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseGetIsPostHighlightedResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 8) {
                        break;
                    }
                    message.isHighlighted = reader.bool();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { isHighlighted: isSet(object.isHighlighted) ? globalThis.Boolean(object.isHighlighted) : false };
    },
    toJSON(message) {
        const obj = {};
        if (message.isHighlighted !== false) {
            obj.isHighlighted = message.isHighlighted;
        }
        return obj;
    },
    create(base) {
        return GetIsPostHighlightedResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseGetIsPostHighlightedResponse();
        message.isHighlighted = object.isHighlighted ?? false;
        return message;
    },
};
messageTypeRegistry.set(GetIsPostHighlightedResponse.$type, GetIsPostHighlightedResponse);
function createBaseAddPostToHighlightsResponse() {
    return {};
}
export const AddPostToHighlightsResponse = {
    $type: "devvit.plugin.redditapi.linksandcomments.AddPostToHighlightsResponse",
    encode(_, writer = _m0.Writer.create()) {
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseAddPostToHighlightsResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    create(base) {
        return AddPostToHighlightsResponse.fromPartial(base ?? {});
    },
    fromPartial(_) {
        const message = createBaseAddPostToHighlightsResponse();
        return message;
    },
};
messageTypeRegistry.set(AddPostToHighlightsResponse.$type, AddPostToHighlightsResponse);
function createBaseRemovePostFromHighlightsResponse() {
    return {};
}
export const RemovePostFromHighlightsResponse = {
    $type: "devvit.plugin.redditapi.linksandcomments.RemovePostFromHighlightsResponse",
    encode(_, writer = _m0.Writer.create()) {
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseRemovePostFromHighlightsResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    create(base) {
        return RemovePostFromHighlightsResponse.fromPartial(base ?? {});
    },
    fromPartial(_) {
        const message = createBaseRemovePostFromHighlightsResponse();
        return message;
    },
};
messageTypeRegistry.set(RemovePostFromHighlightsResponse.$type, RemovePostFromHighlightsResponse);
function createBaseJsonWrappedComment() {
    return { json: undefined };
}
export const JsonWrappedComment = {
    $type: "devvit.plugin.redditapi.linksandcomments.JsonWrappedComment",
    encode(message, writer = _m0.Writer.create()) {
        if (message.json !== undefined) {
            JsonWrappedComment_Json.encode(message.json, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseJsonWrappedComment();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.json = JsonWrappedComment_Json.decode(reader, reader.uint32());
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { json: isSet(object.json) ? JsonWrappedComment_Json.fromJSON(object.json) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.json !== undefined) {
            obj.json = JsonWrappedComment_Json.toJSON(message.json);
        }
        return obj;
    },
    create(base) {
        return JsonWrappedComment.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseJsonWrappedComment();
        message.json = (object.json !== undefined && object.json !== null)
            ? JsonWrappedComment_Json.fromPartial(object.json)
            : undefined;
        return message;
    },
};
messageTypeRegistry.set(JsonWrappedComment.$type, JsonWrappedComment);
function createBaseJsonWrappedComment_WrappedComment() {
    return { kind: "", data: undefined };
}
export const JsonWrappedComment_WrappedComment = {
    $type: "devvit.plugin.redditapi.linksandcomments.JsonWrappedComment.WrappedComment",
    encode(message, writer = _m0.Writer.create()) {
        if (message.kind !== "") {
            writer.uint32(10).string(message.kind);
        }
        if (message.data !== undefined) {
            Comment.encode(message.data, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseJsonWrappedComment_WrappedComment();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.kind = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.data = Comment.decode(reader, reader.uint32());
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            kind: isSet(object.kind) ? globalThis.String(object.kind) : "",
            data: isSet(object.data) ? Comment.fromJSON(object.data) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.kind !== "") {
            obj.kind = message.kind;
        }
        if (message.data !== undefined) {
            obj.data = Comment.toJSON(message.data);
        }
        return obj;
    },
    create(base) {
        return JsonWrappedComment_WrappedComment.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseJsonWrappedComment_WrappedComment();
        message.kind = object.kind ?? "";
        message.data = (object.data !== undefined && object.data !== null) ? Comment.fromPartial(object.data) : undefined;
        return message;
    },
};
messageTypeRegistry.set(JsonWrappedComment_WrappedComment.$type, JsonWrappedComment_WrappedComment);
function createBaseJsonWrappedComment_JsonData() {
    return { things: [] };
}
export const JsonWrappedComment_JsonData = {
    $type: "devvit.plugin.redditapi.linksandcomments.JsonWrappedComment.JsonData",
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.things) {
            JsonWrappedComment_WrappedComment.encode(v, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseJsonWrappedComment_JsonData();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.things.push(JsonWrappedComment_WrappedComment.decode(reader, reader.uint32()));
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            things: globalThis.Array.isArray(object?.things)
                ? object.things.map((e) => JsonWrappedComment_WrappedComment.fromJSON(e))
                : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.things?.length) {
            obj.things = message.things.map((e) => JsonWrappedComment_WrappedComment.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return JsonWrappedComment_JsonData.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseJsonWrappedComment_JsonData();
        message.things = object.things?.map((e) => JsonWrappedComment_WrappedComment.fromPartial(e)) || [];
        return message;
    },
};
messageTypeRegistry.set(JsonWrappedComment_JsonData.$type, JsonWrappedComment_JsonData);
function createBaseJsonWrappedComment_Json() {
    return { errors: [], data: undefined };
}
export const JsonWrappedComment_Json = {
    $type: "devvit.plugin.redditapi.linksandcomments.JsonWrappedComment.Json",
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.errors) {
            writer.uint32(10).string(v);
        }
        if (message.data !== undefined) {
            JsonWrappedComment_JsonData.encode(message.data, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseJsonWrappedComment_Json();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.errors.push(reader.string());
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.data = JsonWrappedComment_JsonData.decode(reader, reader.uint32());
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            errors: globalThis.Array.isArray(object?.errors) ? object.errors.map((e) => globalThis.String(e)) : [],
            data: isSet(object.data) ? JsonWrappedComment_JsonData.fromJSON(object.data) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.errors?.length) {
            obj.errors = message.errors;
        }
        if (message.data !== undefined) {
            obj.data = JsonWrappedComment_JsonData.toJSON(message.data);
        }
        return obj;
    },
    create(base) {
        return JsonWrappedComment_Json.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseJsonWrappedComment_Json();
        message.errors = object.errors?.map((e) => e) || [];
        message.data = (object.data !== undefined && object.data !== null)
            ? JsonWrappedComment_JsonData.fromPartial(object.data)
            : undefined;
        return message;
    },
};
messageTypeRegistry.set(JsonWrappedComment_Json.$type, JsonWrappedComment_Json);
function createBaseSubmitResponse() {
    return { json: undefined };
}
export const SubmitResponse = {
    $type: "devvit.plugin.redditapi.linksandcomments.SubmitResponse",
    encode(message, writer = _m0.Writer.create()) {
        if (message.json !== undefined) {
            SubmitResponse_JsonType.encode(message.json, writer.uint32(34).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSubmitResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 4:
                    if (tag !== 34) {
                        break;
                    }
                    message.json = SubmitResponse_JsonType.decode(reader, reader.uint32());
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { json: isSet(object.json) ? SubmitResponse_JsonType.fromJSON(object.json) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.json !== undefined) {
            obj.json = SubmitResponse_JsonType.toJSON(message.json);
        }
        return obj;
    },
    create(base) {
        return SubmitResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSubmitResponse();
        message.json = (object.json !== undefined && object.json !== null)
            ? SubmitResponse_JsonType.fromPartial(object.json)
            : undefined;
        return message;
    },
};
messageTypeRegistry.set(SubmitResponse.$type, SubmitResponse);
function createBaseSubmitResponse_JsonType() {
    return { errors: [], data: undefined };
}
export const SubmitResponse_JsonType = {
    $type: "devvit.plugin.redditapi.linksandcomments.SubmitResponse.JsonType",
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.errors) {
            Any.encode(v, writer.uint32(10).fork()).ldelim();
        }
        if (message.data !== undefined) {
            SubmitResponse_JsonType_JsonData.encode(message.data, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSubmitResponse_JsonType();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.errors.push(Any.decode(reader, reader.uint32()));
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.data = SubmitResponse_JsonType_JsonData.decode(reader, reader.uint32());
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            errors: globalThis.Array.isArray(object?.errors) ? object.errors.map((e) => Any.fromJSON(e)) : [],
            data: isSet(object.data) ? SubmitResponse_JsonType_JsonData.fromJSON(object.data) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.errors?.length) {
            obj.errors = message.errors.map((e) => Any.toJSON(e));
        }
        if (message.data !== undefined) {
            obj.data = SubmitResponse_JsonType_JsonData.toJSON(message.data);
        }
        return obj;
    },
    create(base) {
        return SubmitResponse_JsonType.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSubmitResponse_JsonType();
        message.errors = object.errors?.map((e) => Any.fromPartial(e)) || [];
        message.data = (object.data !== undefined && object.data !== null)
            ? SubmitResponse_JsonType_JsonData.fromPartial(object.data)
            : undefined;
        return message;
    },
};
messageTypeRegistry.set(SubmitResponse_JsonType.$type, SubmitResponse_JsonType);
function createBaseSubmitResponse_JsonType_JsonData() {
    return { url: undefined, draftsCount: undefined, id: undefined, name: undefined };
}
export const SubmitResponse_JsonType_JsonData = {
    $type: "devvit.plugin.redditapi.linksandcomments.SubmitResponse.JsonType.JsonData",
    encode(message, writer = _m0.Writer.create()) {
        if (message.url !== undefined) {
            StringValue.encode({ value: message.url }, writer.uint32(10).fork()).ldelim();
        }
        if (message.draftsCount !== undefined) {
            Int32Value.encode({ value: message.draftsCount }, writer.uint32(18).fork()).ldelim();
        }
        if (message.id !== undefined) {
            StringValue.encode({ value: message.id }, writer.uint32(26).fork()).ldelim();
        }
        if (message.name !== undefined) {
            StringValue.encode({ value: message.name }, writer.uint32(34).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSubmitResponse_JsonType_JsonData();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.url = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.draftsCount = Int32Value.decode(reader, reader.uint32()).value;
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.id = StringValue.decode(reader, reader.uint32()).value;
                    continue;
                case 4:
                    if (tag !== 34) {
                        break;
                    }
                    message.name = StringValue.decode(reader, reader.uint32()).value;
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            url: isSet(object.url) ? String(object.url) : undefined,
            draftsCount: isSet(object.draftsCount) ? Number(object.draftsCount) : undefined,
            id: isSet(object.id) ? String(object.id) : undefined,
            name: isSet(object.name) ? String(object.name) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.url !== undefined) {
            obj.url = message.url;
        }
        if (message.draftsCount !== undefined) {
            obj.draftsCount = message.draftsCount;
        }
        if (message.id !== undefined) {
            obj.id = message.id;
        }
        if (message.name !== undefined) {
            obj.name = message.name;
        }
        return obj;
    },
    create(base) {
        return SubmitResponse_JsonType_JsonData.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSubmitResponse_JsonType_JsonData();
        message.url = object.url ?? undefined;
        message.draftsCount = object.draftsCount ?? undefined;
        message.id = object.id ?? undefined;
        message.name = object.name ?? undefined;
        return message;
    },
};
messageTypeRegistry.set(SubmitResponse_JsonType_JsonData.$type, SubmitResponse_JsonType_JsonData);
function createBaseSetCustomPostStylesRequest() {
    return { postId: "", customPostStyles: undefined };
}
export const SetCustomPostStylesRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.SetCustomPostStylesRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.postId !== "") {
            writer.uint32(42).string(message.postId);
        }
        if (message.customPostStyles !== undefined) {
            CustomPostStylesInput.encode(message.customPostStyles, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSetCustomPostStylesRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 5:
                    if (tag !== 42) {
                        break;
                    }
                    message.postId = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.customPostStyles = CustomPostStylesInput.decode(reader, reader.uint32());
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            postId: isSet(object.postId) ? globalThis.String(object.postId) : "",
            customPostStyles: isSet(object.customPostStyles)
                ? CustomPostStylesInput.fromJSON(object.customPostStyles)
                : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.postId !== "") {
            obj.postId = message.postId;
        }
        if (message.customPostStyles !== undefined) {
            obj.customPostStyles = CustomPostStylesInput.toJSON(message.customPostStyles);
        }
        return obj;
    },
    create(base) {
        return SetCustomPostStylesRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSetCustomPostStylesRequest();
        message.postId = object.postId ?? "";
        message.customPostStyles = (object.customPostStyles !== undefined && object.customPostStyles !== null)
            ? CustomPostStylesInput.fromPartial(object.customPostStyles)
            : undefined;
        return message;
    },
};
messageTypeRegistry.set(SetCustomPostStylesRequest.$type, SetCustomPostStylesRequest);
function createBaseGetCustomPostStylesRequest() {
    return { postId: "" };
}
export const GetCustomPostStylesRequest = {
    $type: "devvit.plugin.redditapi.linksandcomments.GetCustomPostStylesRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.postId !== "") {
            writer.uint32(42).string(message.postId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseGetCustomPostStylesRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 5:
                    if (tag !== 42) {
                        break;
                    }
                    message.postId = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { postId: isSet(object.postId) ? globalThis.String(object.postId) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.postId !== "") {
            obj.postId = message.postId;
        }
        return obj;
    },
    create(base) {
        return GetCustomPostStylesRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseGetCustomPostStylesRequest();
        message.postId = object.postId ?? "";
        return message;
    },
};
messageTypeRegistry.set(GetCustomPostStylesRequest.$type, GetCustomPostStylesRequest);
function createBaseCustomPostStylesInput() {
    return { backgroundColor: undefined, backgroundColorDark: undefined, height: undefined, shareImageUrl: undefined };
}
export const CustomPostStylesInput = {
    $type: "devvit.plugin.redditapi.linksandcomments.CustomPostStylesInput",
    encode(message, writer = _m0.Writer.create()) {
        if (message.backgroundColor !== undefined) {
            writer.uint32(10).string(message.backgroundColor);
        }
        if (message.backgroundColorDark !== undefined) {
            writer.uint32(18).string(message.backgroundColorDark);
        }
        if (message.height !== undefined) {
            writer.uint32(32).int32(message.height);
        }
        if (message.shareImageUrl !== undefined) {
            writer.uint32(42).string(message.shareImageUrl);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseCustomPostStylesInput();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.backgroundColor = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.backgroundColorDark = reader.string();
                    continue;
                case 4:
                    if (tag !== 32) {
                        break;
                    }
                    message.height = reader.int32();
                    continue;
                case 5:
                    if (tag !== 42) {
                        break;
                    }
                    message.shareImageUrl = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            backgroundColor: isSet(object.backgroundColor) ? globalThis.String(object.backgroundColor) : undefined,
            backgroundColorDark: isSet(object.backgroundColorDark)
                ? globalThis.String(object.backgroundColorDark)
                : undefined,
            height: isSet(object.height) ? entrypointHeightFromJSON(object.height) : undefined,
            shareImageUrl: isSet(object.shareImageUrl) ? globalThis.String(object.shareImageUrl) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.backgroundColor !== undefined) {
            obj.backgroundColor = message.backgroundColor;
        }
        if (message.backgroundColorDark !== undefined) {
            obj.backgroundColorDark = message.backgroundColorDark;
        }
        if (message.height !== undefined) {
            obj.height = entrypointHeightToJSON(message.height);
        }
        if (message.shareImageUrl !== undefined) {
            obj.shareImageUrl = message.shareImageUrl;
        }
        return obj;
    },
    create(base) {
        return CustomPostStylesInput.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseCustomPostStylesInput();
        message.backgroundColor = object.backgroundColor ?? undefined;
        message.backgroundColorDark = object.backgroundColorDark ?? undefined;
        message.height = object.height ?? undefined;
        message.shareImageUrl = object.shareImageUrl ?? undefined;
        return message;
    },
};
messageTypeRegistry.set(CustomPostStylesInput.$type, CustomPostStylesInput);
function longToNumber(long) {
    if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) {
        throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
    }
    return long.toNumber();
}
if (_m0.util.Long !== Long) {
    _m0.util.Long = Long;
    _m0.configure();
}
function isSet(value) {
    return value !== null && value !== undefined;
}
