/**
 * #post.ts
 *
 * Code generated by ts-proto. DO NOT EDIT.
 * @packageDocumentation
 */
/* eslint-disable */
import _m0 from "protobufjs/minimal.js";
import { RequestContext } from "../../../../devvit/platform/v1/request_context.js";
import { Struct } from "../../../../google/protobuf/struct.js";
import { StringValue } from "../../../../google/protobuf/wrappers.js";
import { messageTypeRegistry } from "../../../../typeRegistry.js";
import { AppPermission } from "../../app_permission/v1/app_permission.js";
import { ErrorMessage } from "../../common/v1/error_message.js";
import { Installation } from "../../common/v1/installation.js";
import { UserGeneratedContent } from "../../useractions/v1/useractions.js";
/** The height of the Post entrypoint. This is not expected to change often. */
export var EntrypointHeight;
(function (EntrypointHeight) {
    EntrypointHeight[EntrypointHeight["HEIGHT_UNSPECIFIED"] = 0] = "HEIGHT_UNSPECIFIED";
    EntrypointHeight[EntrypointHeight["REGULAR"] = 1] = "REGULAR";
    EntrypointHeight[EntrypointHeight["TALL"] = 2] = "TALL";
    EntrypointHeight[EntrypointHeight["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(EntrypointHeight || (EntrypointHeight = {}));
export function entrypointHeightFromJSON(object) {
    switch (object) {
        case 0:
        case "HEIGHT_UNSPECIFIED":
            return EntrypointHeight.HEIGHT_UNSPECIFIED;
        case 1:
        case "REGULAR":
            return EntrypointHeight.REGULAR;
        case 2:
        case "TALL":
            return EntrypointHeight.TALL;
        case -1:
        case "UNRECOGNIZED":
        default:
            return EntrypointHeight.UNRECOGNIZED;
    }
}
export function entrypointHeightToJSON(object) {
    switch (object) {
        case EntrypointHeight.HEIGHT_UNSPECIFIED:
            return 0;
        case EntrypointHeight.REGULAR:
            return 1;
        case EntrypointHeight.TALL:
            return 2;
        case EntrypointHeight.UNRECOGNIZED:
        default:
            return -1;
    }
}
/**
 * Matches the values in the MediaService.MimeType enum.
 * See: https://github.snooguts.net/reddit/media-api/blob/master/api/protos/reddit/foundation/media/v1/media.proto
 */
export var ImageDataMimeType;
(function (ImageDataMimeType) {
    ImageDataMimeType[ImageDataMimeType["GIF"] = 0] = "GIF";
    ImageDataMimeType[ImageDataMimeType["JPEG"] = 1] = "JPEG";
    ImageDataMimeType[ImageDataMimeType["PNG"] = 2] = "PNG";
    ImageDataMimeType[ImageDataMimeType["WEBP"] = 3] = "WEBP";
    ImageDataMimeType[ImageDataMimeType["MP4"] = 4] = "MP4";
    ImageDataMimeType[ImageDataMimeType["QUICKTIME"] = 5] = "QUICKTIME";
    ImageDataMimeType[ImageDataMimeType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ImageDataMimeType || (ImageDataMimeType = {}));
export function imageDataMimeTypeFromJSON(object) {
    switch (object) {
        case 0:
        case "GIF":
            return ImageDataMimeType.GIF;
        case 1:
        case "JPEG":
            return ImageDataMimeType.JPEG;
        case 2:
        case "PNG":
            return ImageDataMimeType.PNG;
        case 3:
        case "WEBP":
            return ImageDataMimeType.WEBP;
        case 4:
        case "MP4":
            return ImageDataMimeType.MP4;
        case 5:
        case "QUICKTIME":
            return ImageDataMimeType.QUICKTIME;
        case -1:
        case "UNRECOGNIZED":
        default:
            return ImageDataMimeType.UNRECOGNIZED;
    }
}
export function imageDataMimeTypeToJSON(object) {
    switch (object) {
        case ImageDataMimeType.GIF:
            return 0;
        case ImageDataMimeType.JPEG:
            return 1;
        case ImageDataMimeType.PNG:
            return 2;
        case ImageDataMimeType.WEBP:
            return 3;
        case ImageDataMimeType.MP4:
            return 4;
        case ImageDataMimeType.QUICKTIME:
            return 5;
        case ImageDataMimeType.UNRECOGNIZED:
        default:
            return -1;
    }
}
function createBaseBatchGetDevvitPostRequest() {
    return { postIds: [], requestContexts: [] };
}
export const BatchGetDevvitPostRequest = {
    $type: "reddit.devvit.post.v1.BatchGetDevvitPostRequest",
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.postIds) {
            writer.uint32(10).string(v);
        }
        for (const v of message.requestContexts) {
            RequestContext.encode(v, 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 = createBaseBatchGetDevvitPostRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.postIds.push(reader.string());
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.requestContexts.push(RequestContext.decode(reader, reader.uint32()));
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            postIds: globalThis.Array.isArray(object?.postIds) ? object.postIds.map((e) => globalThis.String(e)) : [],
            requestContexts: globalThis.Array.isArray(object?.requestContexts)
                ? object.requestContexts.map((e) => RequestContext.fromJSON(e))
                : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.postIds?.length) {
            obj.postIds = message.postIds;
        }
        if (message.requestContexts?.length) {
            obj.requestContexts = message.requestContexts.map((e) => RequestContext.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return BatchGetDevvitPostRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseBatchGetDevvitPostRequest();
        message.postIds = object.postIds?.map((e) => e) || [];
        message.requestContexts = object.requestContexts?.map((e) => RequestContext.fromPartial(e)) || [];
        return message;
    },
};
messageTypeRegistry.set(BatchGetDevvitPostRequest.$type, BatchGetDevvitPostRequest);
function createBaseBatchGetDevvitPostResponse() {
    return { posts: [] };
}
export const BatchGetDevvitPostResponse = {
    $type: "reddit.devvit.post.v1.BatchGetDevvitPostResponse",
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.posts) {
            DevvitPost.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 = createBaseBatchGetDevvitPostResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.posts.push(DevvitPost.decode(reader, reader.uint32()));
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            posts: globalThis.Array.isArray(object?.posts) ? object.posts.map((e) => DevvitPost.fromJSON(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.posts?.length) {
            obj.posts = message.posts.map((e) => DevvitPost.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return BatchGetDevvitPostResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseBatchGetDevvitPostResponse();
        message.posts = object.posts?.map((e) => DevvitPost.fromPartial(e)) || [];
        return message;
    },
};
messageTypeRegistry.set(BatchGetDevvitPostResponse.$type, BatchGetDevvitPostResponse);
function createBaseDevvitPost() {
    return {
        initialRender: "",
        installation: undefined,
        richtextFallback: "",
        error: undefined,
        webbitToken: "",
        webViewBaseUrl: "",
        entrypointUrl: "",
        postData: undefined,
        appPermission: undefined,
        entrypoints: [],
        webViewClientData: undefined,
        signedRequestContext: "",
        entrypointHeight: 0,
        styles: undefined,
    };
}
export const DevvitPost = {
    $type: "reddit.devvit.post.v1.DevvitPost",
    encode(message, writer = _m0.Writer.create()) {
        if (message.initialRender !== "") {
            writer.uint32(10).string(message.initialRender);
        }
        if (message.installation !== undefined) {
            Installation.encode(message.installation, writer.uint32(18).fork()).ldelim();
        }
        if (message.richtextFallback !== "") {
            writer.uint32(26).string(message.richtextFallback);
        }
        if (message.error !== undefined) {
            ErrorMessage.encode(message.error, writer.uint32(34).fork()).ldelim();
        }
        if (message.webbitToken !== "") {
            writer.uint32(42).string(message.webbitToken);
        }
        if (message.webViewBaseUrl !== "") {
            writer.uint32(50).string(message.webViewBaseUrl);
        }
        if (message.entrypointUrl !== "") {
            writer.uint32(58).string(message.entrypointUrl);
        }
        if (message.postData !== undefined) {
            Struct.encode(Struct.wrap(message.postData), writer.uint32(66).fork()).ldelim();
        }
        if (message.appPermission !== undefined) {
            AppPermission.encode(message.appPermission, writer.uint32(74).fork()).ldelim();
        }
        for (const v of message.entrypoints) {
            Entrypoint.encode(v, writer.uint32(82).fork()).ldelim();
        }
        if (message.webViewClientData !== undefined) {
            Struct.encode(Struct.wrap(message.webViewClientData), writer.uint32(90).fork()).ldelim();
        }
        if (message.signedRequestContext !== "") {
            writer.uint32(98).string(message.signedRequestContext);
        }
        if (message.entrypointHeight !== 0) {
            writer.uint32(104).int32(message.entrypointHeight);
        }
        if (message.styles !== undefined) {
            CustomPostStyles.encode(message.styles, writer.uint32(114).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 = createBaseDevvitPost();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.initialRender = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.installation = Installation.decode(reader, reader.uint32());
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.richtextFallback = reader.string();
                    continue;
                case 4:
                    if (tag !== 34) {
                        break;
                    }
                    message.error = ErrorMessage.decode(reader, reader.uint32());
                    continue;
                case 5:
                    if (tag !== 42) {
                        break;
                    }
                    message.webbitToken = reader.string();
                    continue;
                case 6:
                    if (tag !== 50) {
                        break;
                    }
                    message.webViewBaseUrl = reader.string();
                    continue;
                case 7:
                    if (tag !== 58) {
                        break;
                    }
                    message.entrypointUrl = reader.string();
                    continue;
                case 8:
                    if (tag !== 66) {
                        break;
                    }
                    message.postData = Struct.unwrap(Struct.decode(reader, reader.uint32()));
                    continue;
                case 9:
                    if (tag !== 74) {
                        break;
                    }
                    message.appPermission = AppPermission.decode(reader, reader.uint32());
                    continue;
                case 10:
                    if (tag !== 82) {
                        break;
                    }
                    message.entrypoints.push(Entrypoint.decode(reader, reader.uint32()));
                    continue;
                case 11:
                    if (tag !== 90) {
                        break;
                    }
                    message.webViewClientData = Struct.unwrap(Struct.decode(reader, reader.uint32()));
                    continue;
                case 12:
                    if (tag !== 98) {
                        break;
                    }
                    message.signedRequestContext = reader.string();
                    continue;
                case 13:
                    if (tag !== 104) {
                        break;
                    }
                    message.entrypointHeight = reader.int32();
                    continue;
                case 14:
                    if (tag !== 114) {
                        break;
                    }
                    message.styles = CustomPostStyles.decode(reader, reader.uint32());
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            initialRender: isSet(object.initialRender) ? globalThis.String(object.initialRender) : "",
            installation: isSet(object.installation) ? Installation.fromJSON(object.installation) : undefined,
            richtextFallback: isSet(object.richtextFallback) ? globalThis.String(object.richtextFallback) : "",
            error: isSet(object.error) ? ErrorMessage.fromJSON(object.error) : undefined,
            webbitToken: isSet(object.webbitToken) ? globalThis.String(object.webbitToken) : "",
            webViewBaseUrl: isSet(object.webViewBaseUrl) ? globalThis.String(object.webViewBaseUrl) : "",
            entrypointUrl: isSet(object.entrypointUrl) ? globalThis.String(object.entrypointUrl) : "",
            postData: isObject(object.postData) ? object.postData : undefined,
            appPermission: isSet(object.appPermission) ? AppPermission.fromJSON(object.appPermission) : undefined,
            entrypoints: globalThis.Array.isArray(object?.entrypoints)
                ? object.entrypoints.map((e) => Entrypoint.fromJSON(e))
                : [],
            webViewClientData: isObject(object.webViewClientData) ? object.webViewClientData : undefined,
            signedRequestContext: isSet(object.signedRequestContext) ? globalThis.String(object.signedRequestContext) : "",
            entrypointHeight: isSet(object.entrypointHeight) ? entrypointHeightFromJSON(object.entrypointHeight) : 0,
            styles: isSet(object.styles) ? CustomPostStyles.fromJSON(object.styles) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.initialRender !== "") {
            obj.initialRender = message.initialRender;
        }
        if (message.installation !== undefined) {
            obj.installation = Installation.toJSON(message.installation);
        }
        if (message.richtextFallback !== "") {
            obj.richtextFallback = message.richtextFallback;
        }
        if (message.error !== undefined) {
            obj.error = ErrorMessage.toJSON(message.error);
        }
        if (message.webbitToken !== "") {
            obj.webbitToken = message.webbitToken;
        }
        if (message.webViewBaseUrl !== "") {
            obj.webViewBaseUrl = message.webViewBaseUrl;
        }
        if (message.entrypointUrl !== "") {
            obj.entrypointUrl = message.entrypointUrl;
        }
        if (message.postData !== undefined) {
            obj.postData = message.postData;
        }
        if (message.appPermission !== undefined) {
            obj.appPermission = AppPermission.toJSON(message.appPermission);
        }
        if (message.entrypoints?.length) {
            obj.entrypoints = message.entrypoints.map((e) => Entrypoint.toJSON(e));
        }
        if (message.webViewClientData !== undefined) {
            obj.webViewClientData = message.webViewClientData;
        }
        if (message.signedRequestContext !== "") {
            obj.signedRequestContext = message.signedRequestContext;
        }
        if (message.entrypointHeight !== 0) {
            obj.entrypointHeight = entrypointHeightToJSON(message.entrypointHeight);
        }
        if (message.styles !== undefined) {
            obj.styles = CustomPostStyles.toJSON(message.styles);
        }
        return obj;
    },
    create(base) {
        return DevvitPost.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseDevvitPost();
        message.initialRender = object.initialRender ?? "";
        message.installation = (object.installation !== undefined && object.installation !== null)
            ? Installation.fromPartial(object.installation)
            : undefined;
        message.richtextFallback = object.richtextFallback ?? "";
        message.error = (object.error !== undefined && object.error !== null)
            ? ErrorMessage.fromPartial(object.error)
            : undefined;
        message.webbitToken = object.webbitToken ?? "";
        message.webViewBaseUrl = object.webViewBaseUrl ?? "";
        message.entrypointUrl = object.entrypointUrl ?? "";
        message.postData = object.postData ?? undefined;
        message.appPermission = (object.appPermission !== undefined && object.appPermission !== null)
            ? AppPermission.fromPartial(object.appPermission)
            : undefined;
        message.entrypoints = object.entrypoints?.map((e) => Entrypoint.fromPartial(e)) || [];
        message.webViewClientData = object.webViewClientData ?? undefined;
        message.signedRequestContext = object.signedRequestContext ?? "";
        message.entrypointHeight = object.entrypointHeight ?? 0;
        message.styles = (object.styles !== undefined && object.styles !== null)
            ? CustomPostStyles.fromPartial(object.styles)
            : undefined;
        return message;
    },
};
messageTypeRegistry.set(DevvitPost.$type, DevvitPost);
function createBaseCustomPostStyles() {
    return { backgroundColor: "", backgroundColorDark: "", heightPixels: 0, height: 0 };
}
export const CustomPostStyles = {
    $type: "reddit.devvit.post.v1.CustomPostStyles",
    encode(message, writer = _m0.Writer.create()) {
        if (message.backgroundColor !== "") {
            writer.uint32(10).string(message.backgroundColor);
        }
        if (message.backgroundColorDark !== "") {
            writer.uint32(18).string(message.backgroundColorDark);
        }
        if (message.heightPixels !== 0) {
            writer.uint32(24).int32(message.heightPixels);
        }
        if (message.height !== 0) {
            writer.uint32(32).int32(message.height);
        }
        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 = createBaseCustomPostStyles();
        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 3:
                    if (tag !== 24) {
                        break;
                    }
                    message.heightPixels = reader.int32();
                    continue;
                case 4:
                    if (tag !== 32) {
                        break;
                    }
                    message.height = reader.int32();
                    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) : "",
            backgroundColorDark: isSet(object.backgroundColorDark) ? globalThis.String(object.backgroundColorDark) : "",
            heightPixels: isSet(object.heightPixels) ? globalThis.Number(object.heightPixels) : 0,
            height: isSet(object.height) ? entrypointHeightFromJSON(object.height) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.backgroundColor !== "") {
            obj.backgroundColor = message.backgroundColor;
        }
        if (message.backgroundColorDark !== "") {
            obj.backgroundColorDark = message.backgroundColorDark;
        }
        if (message.heightPixels !== 0) {
            obj.heightPixels = Math.round(message.heightPixels);
        }
        if (message.height !== 0) {
            obj.height = entrypointHeightToJSON(message.height);
        }
        return obj;
    },
    create(base) {
        return CustomPostStyles.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseCustomPostStyles();
        message.backgroundColor = object.backgroundColor ?? "";
        message.backgroundColorDark = object.backgroundColorDark ?? "";
        message.heightPixels = object.heightPixels ?? 0;
        message.height = object.height ?? 0;
        return message;
    },
};
messageTypeRegistry.set(CustomPostStyles.$type, CustomPostStyles);
function createBaseEntrypoint() {
    return { name: "", url: "" };
}
export const Entrypoint = {
    $type: "reddit.devvit.post.v1.Entrypoint",
    encode(message, writer = _m0.Writer.create()) {
        if (message.name !== "") {
            writer.uint32(10).string(message.name);
        }
        if (message.url !== "") {
            writer.uint32(18).string(message.url);
        }
        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 = createBaseEntrypoint();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.name = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.url = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            name: isSet(object.name) ? globalThis.String(object.name) : "",
            url: isSet(object.url) ? globalThis.String(object.url) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.name !== "") {
            obj.name = message.name;
        }
        if (message.url !== "") {
            obj.url = message.url;
        }
        return obj;
    },
    create(base) {
        return Entrypoint.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseEntrypoint();
        message.name = object.name ?? "";
        message.url = object.url ?? "";
        return message;
    },
};
messageTypeRegistry.set(Entrypoint.$type, Entrypoint);
function createBaseCreateDevvitPostRequest() {
    return {
        appId: "",
        initialRender: "",
        installationId: "",
        location: "",
        richtextFallback: "",
        title: "",
        appDependencies: [],
        ipAddress: "",
        appSlug: "",
        authorIdOverride: "",
        userGeneratedContent: undefined,
        isNsfw: false,
        postData: undefined,
        styles: undefined,
    };
}
export const CreateDevvitPostRequest = {
    $type: "reddit.devvit.post.v1.CreateDevvitPostRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.appId !== "") {
            writer.uint32(10).string(message.appId);
        }
        if (message.initialRender !== "") {
            writer.uint32(18).string(message.initialRender);
        }
        if (message.installationId !== "") {
            writer.uint32(26).string(message.installationId);
        }
        if (message.location !== "") {
            writer.uint32(34).string(message.location);
        }
        if (message.richtextFallback !== "") {
            writer.uint32(42).string(message.richtextFallback);
        }
        if (message.title !== "") {
            writer.uint32(50).string(message.title);
        }
        for (const v of message.appDependencies) {
            AppDependency.encode(v, writer.uint32(58).fork()).ldelim();
        }
        if (message.ipAddress !== "") {
            writer.uint32(66).string(message.ipAddress);
        }
        if (message.appSlug !== "") {
            writer.uint32(74).string(message.appSlug);
        }
        if (message.authorIdOverride !== "") {
            writer.uint32(82).string(message.authorIdOverride);
        }
        if (message.userGeneratedContent !== undefined) {
            UserGeneratedContent.encode(message.userGeneratedContent, writer.uint32(90).fork()).ldelim();
        }
        if (message.isNsfw !== false) {
            writer.uint32(96).bool(message.isNsfw);
        }
        if (message.postData !== undefined) {
            Struct.encode(Struct.wrap(message.postData), writer.uint32(106).fork()).ldelim();
        }
        if (message.styles !== undefined) {
            CustomPostStyles.encode(message.styles, writer.uint32(114).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 = createBaseCreateDevvitPostRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.appId = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.initialRender = reader.string();
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.installationId = reader.string();
                    continue;
                case 4:
                    if (tag !== 34) {
                        break;
                    }
                    message.location = reader.string();
                    continue;
                case 5:
                    if (tag !== 42) {
                        break;
                    }
                    message.richtextFallback = reader.string();
                    continue;
                case 6:
                    if (tag !== 50) {
                        break;
                    }
                    message.title = reader.string();
                    continue;
                case 7:
                    if (tag !== 58) {
                        break;
                    }
                    message.appDependencies.push(AppDependency.decode(reader, reader.uint32()));
                    continue;
                case 8:
                    if (tag !== 66) {
                        break;
                    }
                    message.ipAddress = reader.string();
                    continue;
                case 9:
                    if (tag !== 74) {
                        break;
                    }
                    message.appSlug = reader.string();
                    continue;
                case 10:
                    if (tag !== 82) {
                        break;
                    }
                    message.authorIdOverride = reader.string();
                    continue;
                case 11:
                    if (tag !== 90) {
                        break;
                    }
                    message.userGeneratedContent = UserGeneratedContent.decode(reader, reader.uint32());
                    continue;
                case 12:
                    if (tag !== 96) {
                        break;
                    }
                    message.isNsfw = reader.bool();
                    continue;
                case 13:
                    if (tag !== 106) {
                        break;
                    }
                    message.postData = Struct.unwrap(Struct.decode(reader, reader.uint32()));
                    continue;
                case 14:
                    if (tag !== 114) {
                        break;
                    }
                    message.styles = CustomPostStyles.decode(reader, reader.uint32());
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            appId: isSet(object.appId) ? globalThis.String(object.appId) : "",
            initialRender: isSet(object.initialRender) ? globalThis.String(object.initialRender) : "",
            installationId: isSet(object.installationId) ? globalThis.String(object.installationId) : "",
            location: isSet(object.location) ? globalThis.String(object.location) : "",
            richtextFallback: isSet(object.richtextFallback) ? globalThis.String(object.richtextFallback) : "",
            title: isSet(object.title) ? globalThis.String(object.title) : "",
            appDependencies: globalThis.Array.isArray(object?.appDependencies)
                ? object.appDependencies.map((e) => AppDependency.fromJSON(e))
                : [],
            ipAddress: isSet(object.ipAddress) ? globalThis.String(object.ipAddress) : "",
            appSlug: isSet(object.appSlug) ? globalThis.String(object.appSlug) : "",
            authorIdOverride: isSet(object.authorIdOverride) ? globalThis.String(object.authorIdOverride) : "",
            userGeneratedContent: isSet(object.userGeneratedContent)
                ? UserGeneratedContent.fromJSON(object.userGeneratedContent)
                : undefined,
            isNsfw: isSet(object.isNsfw) ? globalThis.Boolean(object.isNsfw) : false,
            postData: isObject(object.postData) ? object.postData : undefined,
            styles: isSet(object.styles) ? CustomPostStyles.fromJSON(object.styles) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.appId !== "") {
            obj.appId = message.appId;
        }
        if (message.initialRender !== "") {
            obj.initialRender = message.initialRender;
        }
        if (message.installationId !== "") {
            obj.installationId = message.installationId;
        }
        if (message.location !== "") {
            obj.location = message.location;
        }
        if (message.richtextFallback !== "") {
            obj.richtextFallback = message.richtextFallback;
        }
        if (message.title !== "") {
            obj.title = message.title;
        }
        if (message.appDependencies?.length) {
            obj.appDependencies = message.appDependencies.map((e) => AppDependency.toJSON(e));
        }
        if (message.ipAddress !== "") {
            obj.ipAddress = message.ipAddress;
        }
        if (message.appSlug !== "") {
            obj.appSlug = message.appSlug;
        }
        if (message.authorIdOverride !== "") {
            obj.authorIdOverride = message.authorIdOverride;
        }
        if (message.userGeneratedContent !== undefined) {
            obj.userGeneratedContent = UserGeneratedContent.toJSON(message.userGeneratedContent);
        }
        if (message.isNsfw !== false) {
            obj.isNsfw = message.isNsfw;
        }
        if (message.postData !== undefined) {
            obj.postData = message.postData;
        }
        if (message.styles !== undefined) {
            obj.styles = CustomPostStyles.toJSON(message.styles);
        }
        return obj;
    },
    create(base) {
        return CreateDevvitPostRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseCreateDevvitPostRequest();
        message.appId = object.appId ?? "";
        message.initialRender = object.initialRender ?? "";
        message.installationId = object.installationId ?? "";
        message.location = object.location ?? "";
        message.richtextFallback = object.richtextFallback ?? "";
        message.title = object.title ?? "";
        message.appDependencies = object.appDependencies?.map((e) => AppDependency.fromPartial(e)) || [];
        message.ipAddress = object.ipAddress ?? "";
        message.appSlug = object.appSlug ?? "";
        message.authorIdOverride = object.authorIdOverride ?? "";
        message.userGeneratedContent = (object.userGeneratedContent !== undefined && object.userGeneratedContent !== null)
            ? UserGeneratedContent.fromPartial(object.userGeneratedContent)
            : undefined;
        message.isNsfw = object.isNsfw ?? false;
        message.postData = object.postData ?? undefined;
        message.styles = (object.styles !== undefined && object.styles !== null)
            ? CustomPostStyles.fromPartial(object.styles)
            : undefined;
        return message;
    },
};
messageTypeRegistry.set(CreateDevvitPostRequest.$type, CreateDevvitPostRequest);
function createBaseAppDependency() {
    return { packageName: "", version: "" };
}
export const AppDependency = {
    $type: "reddit.devvit.post.v1.AppDependency",
    encode(message, writer = _m0.Writer.create()) {
        if (message.packageName !== "") {
            writer.uint32(10).string(message.packageName);
        }
        if (message.version !== "") {
            writer.uint32(18).string(message.version);
        }
        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 = createBaseAppDependency();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.packageName = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.version = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            packageName: isSet(object.packageName) ? globalThis.String(object.packageName) : "",
            version: isSet(object.version) ? globalThis.String(object.version) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.packageName !== "") {
            obj.packageName = message.packageName;
        }
        if (message.version !== "") {
            obj.version = message.version;
        }
        return obj;
    },
    create(base) {
        return AppDependency.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseAppDependency();
        message.packageName = object.packageName ?? "";
        message.version = object.version ?? "";
        return message;
    },
};
messageTypeRegistry.set(AppDependency.$type, AppDependency);
function createBaseCreateDevvitPostResponse() {
    return { id: "", error: undefined };
}
export const CreateDevvitPostResponse = {
    $type: "reddit.devvit.post.v1.CreateDevvitPostResponse",
    encode(message, writer = _m0.Writer.create()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        if (message.error !== undefined) {
            ErrorMessage.encode(message.error, 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 = createBaseCreateDevvitPostResponse();
        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.error = ErrorMessage.decode(reader, reader.uint32());
                    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) : "",
            error: isSet(object.error) ? ErrorMessage.fromJSON(object.error) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        if (message.error !== undefined) {
            obj.error = ErrorMessage.toJSON(message.error);
        }
        return obj;
    },
    create(base) {
        return CreateDevvitPostResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseCreateDevvitPostResponse();
        message.id = object.id ?? "";
        message.error = (object.error !== undefined && object.error !== null)
            ? ErrorMessage.fromPartial(object.error)
            : undefined;
        return message;
    },
};
messageTypeRegistry.set(CreateDevvitPostResponse.$type, CreateDevvitPostResponse);
function createBaseUpdateDevvitPostRequest() {
    return { id: "", richtextFallback: "", ipAddress: "", postData: undefined, textFallback: undefined };
}
export const UpdateDevvitPostRequest = {
    $type: "reddit.devvit.post.v1.UpdateDevvitPostRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        if (message.richtextFallback !== "") {
            writer.uint32(18).string(message.richtextFallback);
        }
        if (message.ipAddress !== "") {
            writer.uint32(26).string(message.ipAddress);
        }
        if (message.postData !== undefined) {
            Struct.encode(Struct.wrap(message.postData), writer.uint32(34).fork()).ldelim();
        }
        if (message.textFallback !== undefined) {
            StringValue.encode({ value: message.textFallback }, writer.uint32(42).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 = createBaseUpdateDevvitPostRequest();
        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.richtextFallback = reader.string();
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.ipAddress = reader.string();
                    continue;
                case 4:
                    if (tag !== 34) {
                        break;
                    }
                    message.postData = Struct.unwrap(Struct.decode(reader, reader.uint32()));
                    continue;
                case 5:
                    if (tag !== 42) {
                        break;
                    }
                    message.textFallback = StringValue.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) : "",
            richtextFallback: isSet(object.richtextFallback) ? globalThis.String(object.richtextFallback) : "",
            ipAddress: isSet(object.ipAddress) ? globalThis.String(object.ipAddress) : "",
            postData: isObject(object.postData) ? object.postData : undefined,
            textFallback: isSet(object.textFallback) ? String(object.textFallback) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        if (message.richtextFallback !== "") {
            obj.richtextFallback = message.richtextFallback;
        }
        if (message.ipAddress !== "") {
            obj.ipAddress = message.ipAddress;
        }
        if (message.postData !== undefined) {
            obj.postData = message.postData;
        }
        if (message.textFallback !== undefined) {
            obj.textFallback = message.textFallback;
        }
        return obj;
    },
    create(base) {
        return UpdateDevvitPostRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseUpdateDevvitPostRequest();
        message.id = object.id ?? "";
        message.richtextFallback = object.richtextFallback ?? "";
        message.ipAddress = object.ipAddress ?? "";
        message.postData = object.postData ?? undefined;
        message.textFallback = object.textFallback ?? undefined;
        return message;
    },
};
messageTypeRegistry.set(UpdateDevvitPostRequest.$type, UpdateDevvitPostRequest);
function createBaseUpdateDevvitPostResponse() {
    return {};
}
export const UpdateDevvitPostResponse = {
    $type: "reddit.devvit.post.v1.UpdateDevvitPostResponse",
    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 = createBaseUpdateDevvitPostResponse();
        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 UpdateDevvitPostResponse.fromPartial(base ?? {});
    },
    fromPartial(_) {
        const message = createBaseUpdateDevvitPostResponse();
        return message;
    },
};
messageTypeRegistry.set(UpdateDevvitPostResponse.$type, UpdateDevvitPostResponse);
function createBaseUpdateDevvitPostRenderRequest() {
    return { id: "", initialRender: "", ipAddress: "" };
}
export const UpdateDevvitPostRenderRequest = {
    $type: "reddit.devvit.post.v1.UpdateDevvitPostRenderRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        if (message.initialRender !== "") {
            writer.uint32(18).string(message.initialRender);
        }
        if (message.ipAddress !== "") {
            writer.uint32(26).string(message.ipAddress);
        }
        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 = createBaseUpdateDevvitPostRenderRequest();
        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.initialRender = reader.string();
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.ipAddress = 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) : "",
            initialRender: isSet(object.initialRender) ? globalThis.String(object.initialRender) : "",
            ipAddress: isSet(object.ipAddress) ? globalThis.String(object.ipAddress) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        if (message.initialRender !== "") {
            obj.initialRender = message.initialRender;
        }
        if (message.ipAddress !== "") {
            obj.ipAddress = message.ipAddress;
        }
        return obj;
    },
    create(base) {
        return UpdateDevvitPostRenderRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseUpdateDevvitPostRenderRequest();
        message.id = object.id ?? "";
        message.initialRender = object.initialRender ?? "";
        message.ipAddress = object.ipAddress ?? "";
        return message;
    },
};
messageTypeRegistry.set(UpdateDevvitPostRenderRequest.$type, UpdateDevvitPostRenderRequest);
function createBaseUpdateDevvitPostRenderResponse() {
    return {};
}
export const UpdateDevvitPostRenderResponse = {
    $type: "reddit.devvit.post.v1.UpdateDevvitPostRenderResponse",
    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 = createBaseUpdateDevvitPostRenderResponse();
        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 UpdateDevvitPostRenderResponse.fromPartial(base ?? {});
    },
    fromPartial(_) {
        const message = createBaseUpdateDevvitPostRenderResponse();
        return message;
    },
};
messageTypeRegistry.set(UpdateDevvitPostRenderResponse.$type, UpdateDevvitPostRenderResponse);
function createBaseUpdateDevvitPostStylesRequest() {
    return { id: "", styles: undefined };
}
export const UpdateDevvitPostStylesRequest = {
    $type: "reddit.devvit.post.v1.UpdateDevvitPostStylesRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        if (message.styles !== undefined) {
            CustomPostStyles.encode(message.styles, 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 = createBaseUpdateDevvitPostStylesRequest();
        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.styles = CustomPostStyles.decode(reader, reader.uint32());
                    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) : "",
            styles: isSet(object.styles) ? CustomPostStyles.fromJSON(object.styles) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        if (message.styles !== undefined) {
            obj.styles = CustomPostStyles.toJSON(message.styles);
        }
        return obj;
    },
    create(base) {
        return UpdateDevvitPostStylesRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseUpdateDevvitPostStylesRequest();
        message.id = object.id ?? "";
        message.styles = (object.styles !== undefined && object.styles !== null)
            ? CustomPostStyles.fromPartial(object.styles)
            : undefined;
        return message;
    },
};
messageTypeRegistry.set(UpdateDevvitPostStylesRequest.$type, UpdateDevvitPostStylesRequest);
function createBaseUpdateDevvitPostStylesResponse() {
    return { id: "", error: undefined };
}
export const UpdateDevvitPostStylesResponse = {
    $type: "reddit.devvit.post.v1.UpdateDevvitPostStylesResponse",
    encode(message, writer = _m0.Writer.create()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        if (message.error !== undefined) {
            ErrorMessage.encode(message.error, 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 = createBaseUpdateDevvitPostStylesResponse();
        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.error = ErrorMessage.decode(reader, reader.uint32());
                    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) : "",
            error: isSet(object.error) ? ErrorMessage.fromJSON(object.error) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        if (message.error !== undefined) {
            obj.error = ErrorMessage.toJSON(message.error);
        }
        return obj;
    },
    create(base) {
        return UpdateDevvitPostStylesResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseUpdateDevvitPostStylesResponse();
        message.id = object.id ?? "";
        message.error = (object.error !== undefined && object.error !== null)
            ? ErrorMessage.fromPartial(object.error)
            : undefined;
        return message;
    },
};
messageTypeRegistry.set(UpdateDevvitPostStylesResponse.$type, UpdateDevvitPostStylesResponse);
function createBaseCreateCustomPostSnapshotRequest() {
    return { snapshotId: "", renderConfig: "", imageData: "", userId: "", postId: "", mimeType: 0, ipAddress: "" };
}
export const CreateCustomPostSnapshotRequest = {
    $type: "reddit.devvit.post.v1.CreateCustomPostSnapshotRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.snapshotId !== "") {
            writer.uint32(10).string(message.snapshotId);
        }
        if (message.renderConfig !== "") {
            writer.uint32(18).string(message.renderConfig);
        }
        if (message.imageData !== "") {
            writer.uint32(26).string(message.imageData);
        }
        if (message.userId !== "") {
            writer.uint32(34).string(message.userId);
        }
        if (message.postId !== "") {
            writer.uint32(42).string(message.postId);
        }
        if (message.mimeType !== 0) {
            writer.uint32(48).int32(message.mimeType);
        }
        if (message.ipAddress !== "") {
            writer.uint32(58).string(message.ipAddress);
        }
        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 = createBaseCreateCustomPostSnapshotRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.snapshotId = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.renderConfig = reader.string();
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.imageData = reader.string();
                    continue;
                case 4:
                    if (tag !== 34) {
                        break;
                    }
                    message.userId = reader.string();
                    continue;
                case 5:
                    if (tag !== 42) {
                        break;
                    }
                    message.postId = reader.string();
                    continue;
                case 6:
                    if (tag !== 48) {
                        break;
                    }
                    message.mimeType = reader.int32();
                    continue;
                case 7:
                    if (tag !== 58) {
                        break;
                    }
                    message.ipAddress = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            snapshotId: isSet(object.snapshotId) ? globalThis.String(object.snapshotId) : "",
            renderConfig: isSet(object.renderConfig) ? globalThis.String(object.renderConfig) : "",
            imageData: isSet(object.imageData) ? globalThis.String(object.imageData) : "",
            userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
            postId: isSet(object.postId) ? globalThis.String(object.postId) : "",
            mimeType: isSet(object.mimeType) ? imageDataMimeTypeFromJSON(object.mimeType) : 0,
            ipAddress: isSet(object.ipAddress) ? globalThis.String(object.ipAddress) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.snapshotId !== "") {
            obj.snapshotId = message.snapshotId;
        }
        if (message.renderConfig !== "") {
            obj.renderConfig = message.renderConfig;
        }
        if (message.imageData !== "") {
            obj.imageData = message.imageData;
        }
        if (message.userId !== "") {
            obj.userId = message.userId;
        }
        if (message.postId !== "") {
            obj.postId = message.postId;
        }
        if (message.mimeType !== 0) {
            obj.mimeType = imageDataMimeTypeToJSON(message.mimeType);
        }
        if (message.ipAddress !== "") {
            obj.ipAddress = message.ipAddress;
        }
        return obj;
    },
    create(base) {
        return CreateCustomPostSnapshotRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseCreateCustomPostSnapshotRequest();
        message.snapshotId = object.snapshotId ?? "";
        message.renderConfig = object.renderConfig ?? "";
        message.imageData = object.imageData ?? "";
        message.userId = object.userId ?? "";
        message.postId = object.postId ?? "";
        message.mimeType = object.mimeType ?? 0;
        message.ipAddress = object.ipAddress ?? "";
        return message;
    },
};
messageTypeRegistry.set(CreateCustomPostSnapshotRequest.$type, CreateCustomPostSnapshotRequest);
function createBaseCreateCustomPostSnapshotResponse() {
    return { snapshotId: "", renderConfig: "", mediaId: "", userId: "", postId: "", mediaUrl: "" };
}
export const CreateCustomPostSnapshotResponse = {
    $type: "reddit.devvit.post.v1.CreateCustomPostSnapshotResponse",
    encode(message, writer = _m0.Writer.create()) {
        if (message.snapshotId !== "") {
            writer.uint32(10).string(message.snapshotId);
        }
        if (message.renderConfig !== "") {
            writer.uint32(18).string(message.renderConfig);
        }
        if (message.mediaId !== "") {
            writer.uint32(26).string(message.mediaId);
        }
        if (message.userId !== "") {
            writer.uint32(34).string(message.userId);
        }
        if (message.postId !== "") {
            writer.uint32(42).string(message.postId);
        }
        if (message.mediaUrl !== "") {
            writer.uint32(50).string(message.mediaUrl);
        }
        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 = createBaseCreateCustomPostSnapshotResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.snapshotId = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.renderConfig = reader.string();
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.mediaId = reader.string();
                    continue;
                case 4:
                    if (tag !== 34) {
                        break;
                    }
                    message.userId = reader.string();
                    continue;
                case 5:
                    if (tag !== 42) {
                        break;
                    }
                    message.postId = reader.string();
                    continue;
                case 6:
                    if (tag !== 50) {
                        break;
                    }
                    message.mediaUrl = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            snapshotId: isSet(object.snapshotId) ? globalThis.String(object.snapshotId) : "",
            renderConfig: isSet(object.renderConfig) ? globalThis.String(object.renderConfig) : "",
            mediaId: isSet(object.mediaId) ? globalThis.String(object.mediaId) : "",
            userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
            postId: isSet(object.postId) ? globalThis.String(object.postId) : "",
            mediaUrl: isSet(object.mediaUrl) ? globalThis.String(object.mediaUrl) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.snapshotId !== "") {
            obj.snapshotId = message.snapshotId;
        }
        if (message.renderConfig !== "") {
            obj.renderConfig = message.renderConfig;
        }
        if (message.mediaId !== "") {
            obj.mediaId = message.mediaId;
        }
        if (message.userId !== "") {
            obj.userId = message.userId;
        }
        if (message.postId !== "") {
            obj.postId = message.postId;
        }
        if (message.mediaUrl !== "") {
            obj.mediaUrl = message.mediaUrl;
        }
        return obj;
    },
    create(base) {
        return CreateCustomPostSnapshotResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseCreateCustomPostSnapshotResponse();
        message.snapshotId = object.snapshotId ?? "";
        message.renderConfig = object.renderConfig ?? "";
        message.mediaId = object.mediaId ?? "";
        message.userId = object.userId ?? "";
        message.postId = object.postId ?? "";
        message.mediaUrl = object.mediaUrl ?? "";
        return message;
    },
};
messageTypeRegistry.set(CreateCustomPostSnapshotResponse.$type, CreateCustomPostSnapshotResponse);
function createBaseGetCustomPostSnapshotRequest() {
    return { snapshotId: "", userId: "", postId: "" };
}
export const GetCustomPostSnapshotRequest = {
    $type: "reddit.devvit.post.v1.GetCustomPostSnapshotRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.snapshotId !== "") {
            writer.uint32(10).string(message.snapshotId);
        }
        if (message.userId !== "") {
            writer.uint32(18).string(message.userId);
        }
        if (message.postId !== "") {
            writer.uint32(26).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 = createBaseGetCustomPostSnapshotRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.snapshotId = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.userId = reader.string();
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.postId = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            snapshotId: isSet(object.snapshotId) ? globalThis.String(object.snapshotId) : "",
            userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
            postId: isSet(object.postId) ? globalThis.String(object.postId) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.snapshotId !== "") {
            obj.snapshotId = message.snapshotId;
        }
        if (message.userId !== "") {
            obj.userId = message.userId;
        }
        if (message.postId !== "") {
            obj.postId = message.postId;
        }
        return obj;
    },
    create(base) {
        return GetCustomPostSnapshotRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseGetCustomPostSnapshotRequest();
        message.snapshotId = object.snapshotId ?? "";
        message.userId = object.userId ?? "";
        message.postId = object.postId ?? "";
        return message;
    },
};
messageTypeRegistry.set(GetCustomPostSnapshotRequest.$type, GetCustomPostSnapshotRequest);
function createBaseGetCustomPostSnapshotResponse() {
    return { renderConfig: "", mediaId: "", mediaUrl: "" };
}
export const GetCustomPostSnapshotResponse = {
    $type: "reddit.devvit.post.v1.GetCustomPostSnapshotResponse",
    encode(message, writer = _m0.Writer.create()) {
        if (message.renderConfig !== "") {
            writer.uint32(10).string(message.renderConfig);
        }
        if (message.mediaId !== "") {
            writer.uint32(18).string(message.mediaId);
        }
        if (message.mediaUrl !== "") {
            writer.uint32(26).string(message.mediaUrl);
        }
        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 = createBaseGetCustomPostSnapshotResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.renderConfig = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.mediaId = reader.string();
                    continue;
                case 3:
                    if (tag !== 26) {
                        break;
                    }
                    message.mediaUrl = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            renderConfig: isSet(object.renderConfig) ? globalThis.String(object.renderConfig) : "",
            mediaId: isSet(object.mediaId) ? globalThis.String(object.mediaId) : "",
            mediaUrl: isSet(object.mediaUrl) ? globalThis.String(object.mediaUrl) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.renderConfig !== "") {
            obj.renderConfig = message.renderConfig;
        }
        if (message.mediaId !== "") {
            obj.mediaId = message.mediaId;
        }
        if (message.mediaUrl !== "") {
            obj.mediaUrl = message.mediaUrl;
        }
        return obj;
    },
    create(base) {
        return GetCustomPostSnapshotResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseGetCustomPostSnapshotResponse();
        message.renderConfig = object.renderConfig ?? "";
        message.mediaId = object.mediaId ?? "";
        message.mediaUrl = object.mediaUrl ?? "";
        return message;
    },
};
messageTypeRegistry.set(GetCustomPostSnapshotResponse.$type, GetCustomPostSnapshotResponse);
function isObject(value) {
    return typeof value === "object" && value !== null;
}
function isSet(value) {
    return value !== null && value !== undefined;
}
