/**
 * #ads.ts
 *
 * @packageDocumentation
 */
/* eslint-disable */
import _m0 from "protobufjs/minimal.js";
import { messageTypeRegistry } from "../../../../typeRegistry.js";
export var AppPromoStatus;
(function (AppPromoStatus) {
    AppPromoStatus[AppPromoStatus["APS_UNSPECIFIED"] = 0] = "APS_UNSPECIFIED";
    AppPromoStatus[AppPromoStatus["APS_REDDIT_PROMOTED"] = 1] = "APS_REDDIT_PROMOTED";
    AppPromoStatus[AppPromoStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(AppPromoStatus || (AppPromoStatus = {}));
export function appPromoStatusFromJSON(object) {
    switch (object) {
        case 0:
        case "APS_UNSPECIFIED":
            return AppPromoStatus.APS_UNSPECIFIED;
        case 1:
        case "APS_REDDIT_PROMOTED":
            return AppPromoStatus.APS_REDDIT_PROMOTED;
        case -1:
        case "UNRECOGNIZED":
        default:
            return AppPromoStatus.UNRECOGNIZED;
    }
}
export function appPromoStatusToJSON(object) {
    switch (object) {
        case AppPromoStatus.APS_UNSPECIFIED:
            return 0;
        case AppPromoStatus.APS_REDDIT_PROMOTED:
            return 1;
        case AppPromoStatus.UNRECOGNIZED:
        default:
            return -1;
    }
}
function createBaseAdsConfig() {
    return { promoStatus: 0 };
}
export const AdsConfig = {
    $type: "reddit.devvit.ads.v1.AdsConfig",
    encode(message, writer = _m0.Writer.create()) {
        if (message.promoStatus !== 0) {
            writer.uint32(8).int32(message.promoStatus);
        }
        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 = createBaseAdsConfig();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 8) {
                        break;
                    }
                    message.promoStatus = reader.int32();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { promoStatus: isSet(object.promoStatus) ? appPromoStatusFromJSON(object.promoStatus) : 0 };
    },
    toJSON(message) {
        const obj = {};
        if (message.promoStatus !== 0) {
            obj.promoStatus = appPromoStatusToJSON(message.promoStatus);
        }
        return obj;
    },
    create(base) {
        return AdsConfig.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseAdsConfig();
        message.promoStatus = object.promoStatus ?? 0;
        return message;
    },
};
messageTypeRegistry.set(AdsConfig.$type, AdsConfig);
function isSet(value) {
    return value !== null && value !== undefined;
}
