"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AutoLine = exports.ManualLine = exports.RTMPPullInput = exports.RTMPPushInput = exports.PushStreamKey = exports.StreamLine_LabelsEntry = exports.StreamLine = exports.autoLine_AutoLineStatusToJSON = exports.autoLine_AutoLineStatusFromJSON = exports.AutoLine_AutoLineStatus = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const timestamp_1 = require("../../../../google/protobuf/timestamp");
exports.protobufPackage = 'yandex.cloud.video.v1';
/**
 * Enum representing the status of an automatic stream line.
 * Indicates whether the automatic line is active or deactivated.
 */
var AutoLine_AutoLineStatus;
(function (AutoLine_AutoLineStatus) {
    /** AUTO_LINE_STATUS_UNSPECIFIED - Auto line status unspecified. */
    AutoLine_AutoLineStatus[AutoLine_AutoLineStatus["AUTO_LINE_STATUS_UNSPECIFIED"] = 0] = "AUTO_LINE_STATUS_UNSPECIFIED";
    /** DEACTIVATED - The automatic line is deactivated and not currently active. */
    AutoLine_AutoLineStatus[AutoLine_AutoLineStatus["DEACTIVATED"] = 1] = "DEACTIVATED";
    /** ACTIVE - The automatic line is active and operational. */
    AutoLine_AutoLineStatus[AutoLine_AutoLineStatus["ACTIVE"] = 2] = "ACTIVE";
    AutoLine_AutoLineStatus[AutoLine_AutoLineStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(AutoLine_AutoLineStatus = exports.AutoLine_AutoLineStatus || (exports.AutoLine_AutoLineStatus = {}));
function autoLine_AutoLineStatusFromJSON(object) {
    switch (object) {
        case 0:
        case 'AUTO_LINE_STATUS_UNSPECIFIED':
            return AutoLine_AutoLineStatus.AUTO_LINE_STATUS_UNSPECIFIED;
        case 1:
        case 'DEACTIVATED':
            return AutoLine_AutoLineStatus.DEACTIVATED;
        case 2:
        case 'ACTIVE':
            return AutoLine_AutoLineStatus.ACTIVE;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return AutoLine_AutoLineStatus.UNRECOGNIZED;
    }
}
exports.autoLine_AutoLineStatusFromJSON = autoLine_AutoLineStatusFromJSON;
function autoLine_AutoLineStatusToJSON(object) {
    switch (object) {
        case AutoLine_AutoLineStatus.AUTO_LINE_STATUS_UNSPECIFIED:
            return 'AUTO_LINE_STATUS_UNSPECIFIED';
        case AutoLine_AutoLineStatus.DEACTIVATED:
            return 'DEACTIVATED';
        case AutoLine_AutoLineStatus.ACTIVE:
            return 'ACTIVE';
        default:
            return 'UNKNOWN';
    }
}
exports.autoLine_AutoLineStatusToJSON = autoLine_AutoLineStatusToJSON;
const baseStreamLine = { id: '', channelId: '', title: '', thumbnailId: '' };
exports.StreamLine = {
    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.thumbnailId !== '') {
            writer.uint32(34).string(message.thumbnailId);
        }
        if (message.rtmpPush !== undefined) {
            exports.RTMPPushInput.encode(message.rtmpPush, writer.uint32(8002).fork()).ldelim();
        }
        if (message.rtmpPull !== undefined) {
            exports.RTMPPullInput.encode(message.rtmpPull, writer.uint32(8018).fork()).ldelim();
        }
        if (message.manualLine !== undefined) {
            exports.ManualLine.encode(message.manualLine, writer.uint32(16002).fork()).ldelim();
        }
        if (message.autoLine !== undefined) {
            exports.AutoLine.encode(message.autoLine, writer.uint32(16010).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.StreamLine_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({}, baseStreamLine);
        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.thumbnailId = reader.string();
                    break;
                case 1000:
                    message.rtmpPush = exports.RTMPPushInput.decode(reader, reader.uint32());
                    break;
                case 1002:
                    message.rtmpPull = exports.RTMPPullInput.decode(reader, reader.uint32());
                    break;
                case 2000:
                    message.manualLine = exports.ManualLine.decode(reader, reader.uint32());
                    break;
                case 2001:
                    message.autoLine = exports.AutoLine.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.StreamLine_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;
        const message = Object.assign({}, baseStreamLine);
        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.thumbnailId =
            object.thumbnailId !== undefined && object.thumbnailId !== null
                ? String(object.thumbnailId)
                : '';
        message.rtmpPush =
            object.rtmpPush !== undefined && object.rtmpPush !== null
                ? exports.RTMPPushInput.fromJSON(object.rtmpPush)
                : undefined;
        message.rtmpPull =
            object.rtmpPull !== undefined && object.rtmpPull !== null
                ? exports.RTMPPullInput.fromJSON(object.rtmpPull)
                : undefined;
        message.manualLine =
            object.manualLine !== undefined && object.manualLine !== null
                ? exports.ManualLine.fromJSON(object.manualLine)
                : undefined;
        message.autoLine =
            object.autoLine !== undefined && object.autoLine !== null
                ? exports.AutoLine.fromJSON(object.autoLine)
                : 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((_a = object.labels) !== null && _a !== void 0 ? _a : {}).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.thumbnailId !== undefined && (obj.thumbnailId = message.thumbnailId);
        message.rtmpPush !== undefined &&
            (obj.rtmpPush = message.rtmpPush ? exports.RTMPPushInput.toJSON(message.rtmpPush) : undefined);
        message.rtmpPull !== undefined &&
            (obj.rtmpPull = message.rtmpPull ? exports.RTMPPullInput.toJSON(message.rtmpPull) : undefined);
        message.manualLine !== undefined &&
            (obj.manualLine = message.manualLine
                ? exports.ManualLine.toJSON(message.manualLine)
                : undefined);
        message.autoLine !== undefined &&
            (obj.autoLine = message.autoLine ? exports.AutoLine.toJSON(message.autoLine) : 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;
        const message = Object.assign({}, baseStreamLine);
        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.thumbnailId = (_d = object.thumbnailId) !== null && _d !== void 0 ? _d : '';
        message.rtmpPush =
            object.rtmpPush !== undefined && object.rtmpPush !== null
                ? exports.RTMPPushInput.fromPartial(object.rtmpPush)
                : undefined;
        message.rtmpPull =
            object.rtmpPull !== undefined && object.rtmpPull !== null
                ? exports.RTMPPullInput.fromPartial(object.rtmpPull)
                : undefined;
        message.manualLine =
            object.manualLine !== undefined && object.manualLine !== null
                ? exports.ManualLine.fromPartial(object.manualLine)
                : undefined;
        message.autoLine =
            object.autoLine !== undefined && object.autoLine !== null
                ? exports.AutoLine.fromPartial(object.autoLine)
                : undefined;
        message.createdAt = (_e = object.createdAt) !== null && _e !== void 0 ? _e : undefined;
        message.updatedAt = (_f = object.updatedAt) !== null && _f !== void 0 ? _f : undefined;
        message.labels = Object.entries((_g = object.labels) !== null && _g !== void 0 ? _g : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        return message;
    },
};
const baseStreamLine_LabelsEntry = { key: '', value: '' };
exports.StreamLine_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({}, baseStreamLine_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({}, baseStreamLine_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({}, baseStreamLine_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const basePushStreamKey = { key: '' };
exports.PushStreamKey = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.key !== '') {
            writer.uint32(10).string(message.key);
        }
        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({}, basePushStreamKey);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.key = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, basePushStreamKey);
        message.key = object.key !== undefined && object.key !== null ? String(object.key) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.key !== undefined && (obj.key = message.key);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, basePushStreamKey);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseRTMPPushInput = { url: '' };
exports.RTMPPushInput = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.url !== '') {
            writer.uint32(10).string(message.url);
        }
        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({}, baseRTMPPushInput);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.url = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseRTMPPushInput);
        message.url = object.url !== undefined && object.url !== null ? String(object.url) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.url !== undefined && (obj.url = message.url);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseRTMPPushInput);
        message.url = (_a = object.url) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseRTMPPullInput = { url: '' };
exports.RTMPPullInput = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.url !== '') {
            writer.uint32(10).string(message.url);
        }
        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({}, baseRTMPPullInput);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.url = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseRTMPPullInput);
        message.url = object.url !== undefined && object.url !== null ? String(object.url) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.url !== undefined && (obj.url = message.url);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseRTMPPullInput);
        message.url = (_a = object.url) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseManualLine = {};
exports.ManualLine = {
    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({}, baseManualLine);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        const message = Object.assign({}, baseManualLine);
        return message;
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = Object.assign({}, baseManualLine);
        return message;
    },
};
const baseAutoLine = { status: 0 };
exports.AutoLine = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.status !== 0) {
            writer.uint32(8).int32(message.status);
        }
        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({}, baseAutoLine);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.status = reader.int32();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseAutoLine);
        message.status =
            object.status !== undefined && object.status !== null
                ? autoLine_AutoLineStatusFromJSON(object.status)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.status !== undefined &&
            (obj.status = autoLine_AutoLineStatusToJSON(message.status));
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseAutoLine);
        message.status = (_a = object.status) !== null && _a !== void 0 ? _a : 0;
        return message;
    },
};
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));
    }
}
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
