"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VideoFeatures_Summary_SummaryURL = exports.VideoFeatures_Summary = exports.VideoFeatures = exports.VideoSignURLAccessRights = exports.VideoPublicAccessRights = exports.VideoTUSDSource = exports.Video_LabelsEntry = exports.Video = exports.videoFeatures_FeatureResultToJSON = exports.videoFeatures_FeatureResultFromJSON = exports.VideoFeatures_FeatureResult = exports.video_VisibilityStatusToJSON = exports.video_VisibilityStatusFromJSON = exports.Video_VisibilityStatus = exports.video_VideoStatusToJSON = exports.video_VideoStatusFromJSON = exports.Video_VideoStatus = exports.autoTranscodeToJSON = exports.autoTranscodeFromJSON = exports.AutoTranscode = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const duration_1 = require("../../../../google/protobuf/duration");
const timestamp_1 = require("../../../../google/protobuf/timestamp");
const wrappers_1 = require("../../../../google/protobuf/wrappers");
exports.protobufPackage = 'yandex.cloud.video.v1';
var AutoTranscode;
(function (AutoTranscode) {
    /** AUTO_TRANSCODE_UNSPECIFIED - Unspecified auto transcoding value. */
    AutoTranscode[AutoTranscode["AUTO_TRANSCODE_UNSPECIFIED"] = 0] = "AUTO_TRANSCODE_UNSPECIFIED";
    /** ENABLE - Enable auto transcoding. */
    AutoTranscode[AutoTranscode["ENABLE"] = 1] = "ENABLE";
    /** DISABLE - Disable auto transcoding. */
    AutoTranscode[AutoTranscode["DISABLE"] = 2] = "DISABLE";
    AutoTranscode[AutoTranscode["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(AutoTranscode = exports.AutoTranscode || (exports.AutoTranscode = {}));
function autoTranscodeFromJSON(object) {
    switch (object) {
        case 0:
        case 'AUTO_TRANSCODE_UNSPECIFIED':
            return AutoTranscode.AUTO_TRANSCODE_UNSPECIFIED;
        case 1:
        case 'ENABLE':
            return AutoTranscode.ENABLE;
        case 2:
        case 'DISABLE':
            return AutoTranscode.DISABLE;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return AutoTranscode.UNRECOGNIZED;
    }
}
exports.autoTranscodeFromJSON = autoTranscodeFromJSON;
function autoTranscodeToJSON(object) {
    switch (object) {
        case AutoTranscode.AUTO_TRANSCODE_UNSPECIFIED:
            return 'AUTO_TRANSCODE_UNSPECIFIED';
        case AutoTranscode.ENABLE:
            return 'ENABLE';
        case AutoTranscode.DISABLE:
            return 'DISABLE';
        default:
            return 'UNKNOWN';
    }
}
exports.autoTranscodeToJSON = autoTranscodeToJSON;
var Video_VideoStatus;
(function (Video_VideoStatus) {
    /** VIDEO_STATUS_UNSPECIFIED - Video status unspecified. */
    Video_VideoStatus[Video_VideoStatus["VIDEO_STATUS_UNSPECIFIED"] = 0] = "VIDEO_STATUS_UNSPECIFIED";
    /** WAIT_UPLOADING - Waiting for all the bytes to be loaded. */
    Video_VideoStatus[Video_VideoStatus["WAIT_UPLOADING"] = 1] = "WAIT_UPLOADING";
    /** UPLOADED - Fully uploaded, ready to be transcoded. */
    Video_VideoStatus[Video_VideoStatus["UPLOADED"] = 2] = "UPLOADED";
    /** PROCESSING - Video is being processed. */
    Video_VideoStatus[Video_VideoStatus["PROCESSING"] = 4] = "PROCESSING";
    /** READY - Successfully processed and ready for use. */
    Video_VideoStatus[Video_VideoStatus["READY"] = 5] = "READY";
    /** ERROR - Video processing has failed. */
    Video_VideoStatus[Video_VideoStatus["ERROR"] = 7] = "ERROR";
    Video_VideoStatus[Video_VideoStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(Video_VideoStatus = exports.Video_VideoStatus || (exports.Video_VideoStatus = {}));
function video_VideoStatusFromJSON(object) {
    switch (object) {
        case 0:
        case 'VIDEO_STATUS_UNSPECIFIED':
            return Video_VideoStatus.VIDEO_STATUS_UNSPECIFIED;
        case 1:
        case 'WAIT_UPLOADING':
            return Video_VideoStatus.WAIT_UPLOADING;
        case 2:
        case 'UPLOADED':
            return Video_VideoStatus.UPLOADED;
        case 4:
        case 'PROCESSING':
            return Video_VideoStatus.PROCESSING;
        case 5:
        case 'READY':
            return Video_VideoStatus.READY;
        case 7:
        case 'ERROR':
            return Video_VideoStatus.ERROR;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return Video_VideoStatus.UNRECOGNIZED;
    }
}
exports.video_VideoStatusFromJSON = video_VideoStatusFromJSON;
function video_VideoStatusToJSON(object) {
    switch (object) {
        case Video_VideoStatus.VIDEO_STATUS_UNSPECIFIED:
            return 'VIDEO_STATUS_UNSPECIFIED';
        case Video_VideoStatus.WAIT_UPLOADING:
            return 'WAIT_UPLOADING';
        case Video_VideoStatus.UPLOADED:
            return 'UPLOADED';
        case Video_VideoStatus.PROCESSING:
            return 'PROCESSING';
        case Video_VideoStatus.READY:
            return 'READY';
        case Video_VideoStatus.ERROR:
            return 'ERROR';
        default:
            return 'UNKNOWN';
    }
}
exports.video_VideoStatusToJSON = video_VideoStatusToJSON;
var Video_VisibilityStatus;
(function (Video_VisibilityStatus) {
    /** VISIBILITY_STATUS_UNSPECIFIED - Visibility status unspecified. */
    Video_VisibilityStatus[Video_VisibilityStatus["VISIBILITY_STATUS_UNSPECIFIED"] = 0] = "VISIBILITY_STATUS_UNSPECIFIED";
    /** PUBLISHED - Video published and available for public viewing. */
    Video_VisibilityStatus[Video_VisibilityStatus["PUBLISHED"] = 1] = "PUBLISHED";
    /** UNPUBLISHED - Video unpublished, available only to administrators. */
    Video_VisibilityStatus[Video_VisibilityStatus["UNPUBLISHED"] = 2] = "UNPUBLISHED";
    Video_VisibilityStatus[Video_VisibilityStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(Video_VisibilityStatus = exports.Video_VisibilityStatus || (exports.Video_VisibilityStatus = {}));
function video_VisibilityStatusFromJSON(object) {
    switch (object) {
        case 0:
        case 'VISIBILITY_STATUS_UNSPECIFIED':
            return Video_VisibilityStatus.VISIBILITY_STATUS_UNSPECIFIED;
        case 1:
        case 'PUBLISHED':
            return Video_VisibilityStatus.PUBLISHED;
        case 2:
        case 'UNPUBLISHED':
            return Video_VisibilityStatus.UNPUBLISHED;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return Video_VisibilityStatus.UNRECOGNIZED;
    }
}
exports.video_VisibilityStatusFromJSON = video_VisibilityStatusFromJSON;
function video_VisibilityStatusToJSON(object) {
    switch (object) {
        case Video_VisibilityStatus.VISIBILITY_STATUS_UNSPECIFIED:
            return 'VISIBILITY_STATUS_UNSPECIFIED';
        case Video_VisibilityStatus.PUBLISHED:
            return 'PUBLISHED';
        case Video_VisibilityStatus.UNPUBLISHED:
            return 'UNPUBLISHED';
        default:
            return 'UNKNOWN';
    }
}
exports.video_VisibilityStatusToJSON = video_VisibilityStatusToJSON;
var VideoFeatures_FeatureResult;
(function (VideoFeatures_FeatureResult) {
    VideoFeatures_FeatureResult[VideoFeatures_FeatureResult["FEATURE_RESULT_UNSPECIFIED"] = 0] = "FEATURE_RESULT_UNSPECIFIED";
    /** NOT_REQUESTED - Feature has not been requested. */
    VideoFeatures_FeatureResult[VideoFeatures_FeatureResult["NOT_REQUESTED"] = 1] = "NOT_REQUESTED";
    /** PROCESSING - Feature is being processed. */
    VideoFeatures_FeatureResult[VideoFeatures_FeatureResult["PROCESSING"] = 2] = "PROCESSING";
    /** SUCCESS - Feature processing completed successfully. */
    VideoFeatures_FeatureResult[VideoFeatures_FeatureResult["SUCCESS"] = 3] = "SUCCESS";
    /** FAILED - Feature processing has failed. */
    VideoFeatures_FeatureResult[VideoFeatures_FeatureResult["FAILED"] = 4] = "FAILED";
    VideoFeatures_FeatureResult[VideoFeatures_FeatureResult["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(VideoFeatures_FeatureResult = exports.VideoFeatures_FeatureResult || (exports.VideoFeatures_FeatureResult = {}));
function videoFeatures_FeatureResultFromJSON(object) {
    switch (object) {
        case 0:
        case 'FEATURE_RESULT_UNSPECIFIED':
            return VideoFeatures_FeatureResult.FEATURE_RESULT_UNSPECIFIED;
        case 1:
        case 'NOT_REQUESTED':
            return VideoFeatures_FeatureResult.NOT_REQUESTED;
        case 2:
        case 'PROCESSING':
            return VideoFeatures_FeatureResult.PROCESSING;
        case 3:
        case 'SUCCESS':
            return VideoFeatures_FeatureResult.SUCCESS;
        case 4:
        case 'FAILED':
            return VideoFeatures_FeatureResult.FAILED;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return VideoFeatures_FeatureResult.UNRECOGNIZED;
    }
}
exports.videoFeatures_FeatureResultFromJSON = videoFeatures_FeatureResultFromJSON;
function videoFeatures_FeatureResultToJSON(object) {
    switch (object) {
        case VideoFeatures_FeatureResult.FEATURE_RESULT_UNSPECIFIED:
            return 'FEATURE_RESULT_UNSPECIFIED';
        case VideoFeatures_FeatureResult.NOT_REQUESTED:
            return 'NOT_REQUESTED';
        case VideoFeatures_FeatureResult.PROCESSING:
            return 'PROCESSING';
        case VideoFeatures_FeatureResult.SUCCESS:
            return 'SUCCESS';
        case VideoFeatures_FeatureResult.FAILED:
            return 'FAILED';
        default:
            return 'UNKNOWN';
    }
}
exports.videoFeatures_FeatureResultToJSON = videoFeatures_FeatureResultToJSON;
const baseVideo = {
    id: '',
    channelId: '',
    title: '',
    description: '',
    thumbnailId: '',
    status: 0,
    errorMessage: '',
    visibilityStatus: 0,
    autoTranscode: 0,
    subtitleIds: '',
};
exports.Video = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.id !== '') {
            writer.uint32(10).string(message.id);
        }
        if (message.channelId !== '') {
            writer.uint32(18).string(message.channelId);
        }
        if (message.title !== '') {
            writer.uint32(26).string(message.title);
        }
        if (message.description !== '') {
            writer.uint32(34).string(message.description);
        }
        if (message.thumbnailId !== '') {
            writer.uint32(42).string(message.thumbnailId);
        }
        if (message.status !== 0) {
            writer.uint32(48).int32(message.status);
        }
        if (message.errorMessage !== '') {
            writer.uint32(146).string(message.errorMessage);
        }
        if (message.visibilityStatus !== 0) {
            writer.uint32(72).int32(message.visibilityStatus);
        }
        if (message.duration !== undefined) {
            duration_1.Duration.encode(message.duration, writer.uint32(66).fork()).ldelim();
        }
        if (message.autoTranscode !== 0) {
            writer.uint32(88).int32(message.autoTranscode);
        }
        if (message.enableAd !== undefined) {
            wrappers_1.BoolValue.encode({ value: message.enableAd }, writer.uint32(138).fork()).ldelim();
        }
        for (const v of message.subtitleIds) {
            writer.uint32(98).string(v);
        }
        if (message.features !== undefined) {
            exports.VideoFeatures.encode(message.features, writer.uint32(106).fork()).ldelim();
        }
        if (message.tusd !== undefined) {
            exports.VideoTUSDSource.encode(message.tusd, writer.uint32(8002).fork()).ldelim();
        }
        if (message.publicAccess !== undefined) {
            exports.VideoPublicAccessRights.encode(message.publicAccess, writer.uint32(16002).fork()).ldelim();
        }
        if (message.signUrlAccess !== undefined) {
            exports.VideoSignURLAccessRights.encode(message.signUrlAccess, writer.uint32(16026).fork()).ldelim();
        }
        if (message.createdAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(802).fork()).ldelim();
        }
        if (message.updatedAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(810).fork()).ldelim();
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.Video_LabelsEntry.encode({ key: key, value }, writer.uint32(1602).fork()).ldelim();
        });
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseVideo);
        message.subtitleIds = [];
        message.labels = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.id = reader.string();
                    break;
                case 2:
                    message.channelId = reader.string();
                    break;
                case 3:
                    message.title = reader.string();
                    break;
                case 4:
                    message.description = reader.string();
                    break;
                case 5:
                    message.thumbnailId = reader.string();
                    break;
                case 6:
                    message.status = reader.int32();
                    break;
                case 18:
                    message.errorMessage = reader.string();
                    break;
                case 9:
                    message.visibilityStatus = reader.int32();
                    break;
                case 8:
                    message.duration = duration_1.Duration.decode(reader, reader.uint32());
                    break;
                case 11:
                    message.autoTranscode = reader.int32();
                    break;
                case 17:
                    message.enableAd = wrappers_1.BoolValue.decode(reader, reader.uint32()).value;
                    break;
                case 12:
                    message.subtitleIds.push(reader.string());
                    break;
                case 13:
                    message.features = exports.VideoFeatures.decode(reader, reader.uint32());
                    break;
                case 1000:
                    message.tusd = exports.VideoTUSDSource.decode(reader, reader.uint32());
                    break;
                case 2000:
                    message.publicAccess = exports.VideoPublicAccessRights.decode(reader, reader.uint32());
                    break;
                case 2003:
                    message.signUrlAccess = exports.VideoSignURLAccessRights.decode(reader, reader.uint32());
                    break;
                case 100:
                    message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 101:
                    message.updatedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 200:
                    const entry200 = exports.Video_LabelsEntry.decode(reader, reader.uint32());
                    if (entry200.value !== undefined) {
                        message.labels[entry200.key] = entry200.value;
                    }
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b;
        const message = Object.assign({}, baseVideo);
        message.id = object.id !== undefined && object.id !== null ? String(object.id) : '';
        message.channelId =
            object.channelId !== undefined && object.channelId !== null
                ? String(object.channelId)
                : '';
        message.title =
            object.title !== undefined && object.title !== null ? String(object.title) : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.thumbnailId =
            object.thumbnailId !== undefined && object.thumbnailId !== null
                ? String(object.thumbnailId)
                : '';
        message.status =
            object.status !== undefined && object.status !== null
                ? video_VideoStatusFromJSON(object.status)
                : 0;
        message.errorMessage =
            object.errorMessage !== undefined && object.errorMessage !== null
                ? String(object.errorMessage)
                : '';
        message.visibilityStatus =
            object.visibilityStatus !== undefined && object.visibilityStatus !== null
                ? video_VisibilityStatusFromJSON(object.visibilityStatus)
                : 0;
        message.duration =
            object.duration !== undefined && object.duration !== null
                ? duration_1.Duration.fromJSON(object.duration)
                : undefined;
        message.autoTranscode =
            object.autoTranscode !== undefined && object.autoTranscode !== null
                ? autoTranscodeFromJSON(object.autoTranscode)
                : 0;
        message.enableAd =
            object.enableAd !== undefined && object.enableAd !== null
                ? Boolean(object.enableAd)
                : undefined;
        message.subtitleIds = ((_a = object.subtitleIds) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        message.features =
            object.features !== undefined && object.features !== null
                ? exports.VideoFeatures.fromJSON(object.features)
                : undefined;
        message.tusd =
            object.tusd !== undefined && object.tusd !== null
                ? exports.VideoTUSDSource.fromJSON(object.tusd)
                : undefined;
        message.publicAccess =
            object.publicAccess !== undefined && object.publicAccess !== null
                ? exports.VideoPublicAccessRights.fromJSON(object.publicAccess)
                : undefined;
        message.signUrlAccess =
            object.signUrlAccess !== undefined && object.signUrlAccess !== null
                ? exports.VideoSignURLAccessRights.fromJSON(object.signUrlAccess)
                : undefined;
        message.createdAt =
            object.createdAt !== undefined && object.createdAt !== null
                ? fromJsonTimestamp(object.createdAt)
                : undefined;
        message.updatedAt =
            object.updatedAt !== undefined && object.updatedAt !== null
                ? fromJsonTimestamp(object.updatedAt)
                : undefined;
        message.labels = Object.entries((_b = object.labels) !== null && _b !== void 0 ? _b : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.id !== undefined && (obj.id = message.id);
        message.channelId !== undefined && (obj.channelId = message.channelId);
        message.title !== undefined && (obj.title = message.title);
        message.description !== undefined && (obj.description = message.description);
        message.thumbnailId !== undefined && (obj.thumbnailId = message.thumbnailId);
        message.status !== undefined && (obj.status = video_VideoStatusToJSON(message.status));
        message.errorMessage !== undefined && (obj.errorMessage = message.errorMessage);
        message.visibilityStatus !== undefined &&
            (obj.visibilityStatus = video_VisibilityStatusToJSON(message.visibilityStatus));
        message.duration !== undefined &&
            (obj.duration = message.duration ? duration_1.Duration.toJSON(message.duration) : undefined);
        message.autoTranscode !== undefined &&
            (obj.autoTranscode = autoTranscodeToJSON(message.autoTranscode));
        message.enableAd !== undefined && (obj.enableAd = message.enableAd);
        if (message.subtitleIds) {
            obj.subtitleIds = message.subtitleIds.map((e) => e);
        }
        else {
            obj.subtitleIds = [];
        }
        message.features !== undefined &&
            (obj.features = message.features ? exports.VideoFeatures.toJSON(message.features) : undefined);
        message.tusd !== undefined &&
            (obj.tusd = message.tusd ? exports.VideoTUSDSource.toJSON(message.tusd) : undefined);
        message.publicAccess !== undefined &&
            (obj.publicAccess = message.publicAccess
                ? exports.VideoPublicAccessRights.toJSON(message.publicAccess)
                : undefined);
        message.signUrlAccess !== undefined &&
            (obj.signUrlAccess = message.signUrlAccess
                ? exports.VideoSignURLAccessRights.toJSON(message.signUrlAccess)
                : undefined);
        message.createdAt !== undefined && (obj.createdAt = message.createdAt.toISOString());
        message.updatedAt !== undefined && (obj.updatedAt = message.updatedAt.toISOString());
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
        const message = Object.assign({}, baseVideo);
        message.id = (_a = object.id) !== null && _a !== void 0 ? _a : '';
        message.channelId = (_b = object.channelId) !== null && _b !== void 0 ? _b : '';
        message.title = (_c = object.title) !== null && _c !== void 0 ? _c : '';
        message.description = (_d = object.description) !== null && _d !== void 0 ? _d : '';
        message.thumbnailId = (_e = object.thumbnailId) !== null && _e !== void 0 ? _e : '';
        message.status = (_f = object.status) !== null && _f !== void 0 ? _f : 0;
        message.errorMessage = (_g = object.errorMessage) !== null && _g !== void 0 ? _g : '';
        message.visibilityStatus = (_h = object.visibilityStatus) !== null && _h !== void 0 ? _h : 0;
        message.duration =
            object.duration !== undefined && object.duration !== null
                ? duration_1.Duration.fromPartial(object.duration)
                : undefined;
        message.autoTranscode = (_j = object.autoTranscode) !== null && _j !== void 0 ? _j : 0;
        message.enableAd = (_k = object.enableAd) !== null && _k !== void 0 ? _k : undefined;
        message.subtitleIds = ((_l = object.subtitleIds) === null || _l === void 0 ? void 0 : _l.map((e) => e)) || [];
        message.features =
            object.features !== undefined && object.features !== null
                ? exports.VideoFeatures.fromPartial(object.features)
                : undefined;
        message.tusd =
            object.tusd !== undefined && object.tusd !== null
                ? exports.VideoTUSDSource.fromPartial(object.tusd)
                : undefined;
        message.publicAccess =
            object.publicAccess !== undefined && object.publicAccess !== null
                ? exports.VideoPublicAccessRights.fromPartial(object.publicAccess)
                : undefined;
        message.signUrlAccess =
            object.signUrlAccess !== undefined && object.signUrlAccess !== null
                ? exports.VideoSignURLAccessRights.fromPartial(object.signUrlAccess)
                : undefined;
        message.createdAt = (_m = object.createdAt) !== null && _m !== void 0 ? _m : undefined;
        message.updatedAt = (_o = object.updatedAt) !== null && _o !== void 0 ? _o : undefined;
        message.labels = Object.entries((_p = object.labels) !== null && _p !== void 0 ? _p : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        return message;
    },
};
const baseVideo_LabelsEntry = { key: '', value: '' };
exports.Video_LabelsEntry = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.key !== '') {
            writer.uint32(10).string(message.key);
        }
        if (message.value !== '') {
            writer.uint32(18).string(message.value);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseVideo_LabelsEntry);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.key = reader.string();
                    break;
                case 2:
                    message.value = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseVideo_LabelsEntry);
        message.key = object.key !== undefined && object.key !== null ? String(object.key) : '';
        message.value =
            object.value !== undefined && object.value !== null ? String(object.value) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.key !== undefined && (obj.key = message.key);
        message.value !== undefined && (obj.value = message.value);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseVideo_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseVideoTUSDSource = { url: '', fileSize: 0 };
exports.VideoTUSDSource = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.url !== '') {
            writer.uint32(10).string(message.url);
        }
        if (message.fileSize !== 0) {
            writer.uint32(16).int64(message.fileSize);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseVideoTUSDSource);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.url = reader.string();
                    break;
                case 2:
                    message.fileSize = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseVideoTUSDSource);
        message.url = object.url !== undefined && object.url !== null ? String(object.url) : '';
        message.fileSize =
            object.fileSize !== undefined && object.fileSize !== null ? Number(object.fileSize) : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.url !== undefined && (obj.url = message.url);
        message.fileSize !== undefined && (obj.fileSize = Math.round(message.fileSize));
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseVideoTUSDSource);
        message.url = (_a = object.url) !== null && _a !== void 0 ? _a : '';
        message.fileSize = (_b = object.fileSize) !== null && _b !== void 0 ? _b : 0;
        return message;
    },
};
const baseVideoPublicAccessRights = {};
exports.VideoPublicAccessRights = {
    encode(_, writer = minimal_1.default.Writer.create()) {
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseVideoPublicAccessRights);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        const message = Object.assign({}, baseVideoPublicAccessRights);
        return message;
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = Object.assign({}, baseVideoPublicAccessRights);
        return message;
    },
};
const baseVideoSignURLAccessRights = {};
exports.VideoSignURLAccessRights = {
    encode(_, writer = minimal_1.default.Writer.create()) {
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseVideoSignURLAccessRights);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        const message = Object.assign({}, baseVideoSignURLAccessRights);
        return message;
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = Object.assign({}, baseVideoSignURLAccessRights);
        return message;
    },
};
const baseVideoFeatures = {};
exports.VideoFeatures = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.summary !== undefined) {
            exports.VideoFeatures_Summary.encode(message.summary, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseVideoFeatures);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.summary = exports.VideoFeatures_Summary.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseVideoFeatures);
        message.summary =
            object.summary !== undefined && object.summary !== null
                ? exports.VideoFeatures_Summary.fromJSON(object.summary)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.summary !== undefined &&
            (obj.summary = message.summary
                ? exports.VideoFeatures_Summary.toJSON(message.summary)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseVideoFeatures);
        message.summary =
            object.summary !== undefined && object.summary !== null
                ? exports.VideoFeatures_Summary.fromPartial(object.summary)
                : undefined;
        return message;
    },
};
const baseVideoFeatures_Summary = { result: 0 };
exports.VideoFeatures_Summary = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.result !== 0) {
            writer.uint32(8).int32(message.result);
        }
        for (const v of message.urls) {
            exports.VideoFeatures_Summary_SummaryURL.encode(v, writer.uint32(26).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseVideoFeatures_Summary);
        message.urls = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.result = reader.int32();
                    break;
                case 3:
                    message.urls.push(exports.VideoFeatures_Summary_SummaryURL.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseVideoFeatures_Summary);
        message.result =
            object.result !== undefined && object.result !== null
                ? videoFeatures_FeatureResultFromJSON(object.result)
                : 0;
        message.urls = ((_a = object.urls) !== null && _a !== void 0 ? _a : []).map((e) => exports.VideoFeatures_Summary_SummaryURL.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.result !== undefined &&
            (obj.result = videoFeatures_FeatureResultToJSON(message.result));
        if (message.urls) {
            obj.urls = message.urls.map((e) => e ? exports.VideoFeatures_Summary_SummaryURL.toJSON(e) : undefined);
        }
        else {
            obj.urls = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseVideoFeatures_Summary);
        message.result = (_a = object.result) !== null && _a !== void 0 ? _a : 0;
        message.urls =
            ((_b = object.urls) === null || _b === void 0 ? void 0 : _b.map((e) => exports.VideoFeatures_Summary_SummaryURL.fromPartial(e))) || [];
        return message;
    },
};
const baseVideoFeatures_Summary_SummaryURL = { url: '', trackIndex: 0, srcLang: '' };
exports.VideoFeatures_Summary_SummaryURL = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.url !== '') {
            writer.uint32(10).string(message.url);
        }
        if (message.trackIndex !== 0) {
            writer.uint32(16).int64(message.trackIndex);
        }
        if (message.srcLang !== '') {
            writer.uint32(26).string(message.srcLang);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseVideoFeatures_Summary_SummaryURL);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.url = reader.string();
                    break;
                case 2:
                    message.trackIndex = longToNumber(reader.int64());
                    break;
                case 3:
                    message.srcLang = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseVideoFeatures_Summary_SummaryURL);
        message.url = object.url !== undefined && object.url !== null ? String(object.url) : '';
        message.trackIndex =
            object.trackIndex !== undefined && object.trackIndex !== null
                ? Number(object.trackIndex)
                : 0;
        message.srcLang =
            object.srcLang !== undefined && object.srcLang !== null ? String(object.srcLang) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.url !== undefined && (obj.url = message.url);
        message.trackIndex !== undefined && (obj.trackIndex = Math.round(message.trackIndex));
        message.srcLang !== undefined && (obj.srcLang = message.srcLang);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseVideoFeatures_Summary_SummaryURL);
        message.url = (_a = object.url) !== null && _a !== void 0 ? _a : '';
        message.trackIndex = (_b = object.trackIndex) !== null && _b !== void 0 ? _b : 0;
        message.srcLang = (_c = object.srcLang) !== null && _c !== void 0 ? _c : '';
        return message;
    },
};
var globalThis = (() => {
    if (typeof globalThis !== 'undefined')
        return globalThis;
    if (typeof self !== 'undefined')
        return self;
    if (typeof window !== 'undefined')
        return window;
    if (typeof global !== 'undefined')
        return global;
    throw 'Unable to locate global object';
})();
function toTimestamp(date) {
    const seconds = date.getTime() / 1000;
    const nanos = (date.getTime() % 1000) * 1000000;
    return { seconds, nanos };
}
function fromTimestamp(t) {
    let millis = t.seconds * 1000;
    millis += t.nanos / 1000000;
    return new Date(millis);
}
function fromJsonTimestamp(o) {
    if (o instanceof Date) {
        return o;
    }
    else if (typeof o === 'string') {
        return new Date(o);
    }
    else {
        return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
    }
}
function longToNumber(long) {
    if (long.gt(Number.MAX_SAFE_INTEGER)) {
        throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER');
    }
    return long.toNumber();
}
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
