// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.2.0 // protoc v5.28.0 // source: video_streaming/request_cancellation_policy.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "video_streaming"; export interface RequestCancellationPolicy { N0?: number | undefined; items: RequestCancellationPolicy_Item[]; jq?: number | undefined; } export interface RequestCancellationPolicy_Item { fR?: number | undefined; NK?: number | undefined; minReadaheadMs?: number | undefined; } function createBaseRequestCancellationPolicy(): RequestCancellationPolicy { return { N0: 0, items: [], jq: 0 }; } export const RequestCancellationPolicy: MessageFns = { encode(message: RequestCancellationPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.N0 !== undefined && message.N0 !== 0) { writer.uint32(8).int32(message.N0); } for (const v of message.items) { RequestCancellationPolicy_Item.encode(v!, writer.uint32(18).fork()).join(); } if (message.jq !== undefined && message.jq !== 0) { writer.uint32(24).int32(message.jq); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RequestCancellationPolicy { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestCancellationPolicy(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 8) { break; } message.N0 = reader.int32(); continue; case 2: if (tag !== 18) { break; } message.items.push(RequestCancellationPolicy_Item.decode(reader, reader.uint32())); continue; case 3: if (tag !== 24) { break; } message.jq = reader.int32(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): RequestCancellationPolicy { return { N0: isSet(object.N0) ? globalThis.Number(object.N0) : 0, items: globalThis.Array.isArray(object?.items) ? object.items.map((e: any) => RequestCancellationPolicy_Item.fromJSON(e)) : [], jq: isSet(object.jq) ? globalThis.Number(object.jq) : 0, }; }, toJSON(message: RequestCancellationPolicy): unknown { const obj: any = {}; if (message.N0 !== undefined && message.N0 !== 0) { obj.N0 = Math.round(message.N0); } if (message.items?.length) { obj.items = message.items.map((e) => RequestCancellationPolicy_Item.toJSON(e)); } if (message.jq !== undefined && message.jq !== 0) { obj.jq = Math.round(message.jq); } return obj; }, create, I>>(base?: I): RequestCancellationPolicy { return RequestCancellationPolicy.fromPartial(base ?? ({} as any)); }, fromPartial, I>>(object: I): RequestCancellationPolicy { const message = createBaseRequestCancellationPolicy(); message.N0 = object.N0 ?? 0; message.items = object.items?.map((e) => RequestCancellationPolicy_Item.fromPartial(e)) || []; message.jq = object.jq ?? 0; return message; }, }; function createBaseRequestCancellationPolicy_Item(): RequestCancellationPolicy_Item { return { fR: 0, NK: 0, minReadaheadMs: 0 }; } export const RequestCancellationPolicy_Item: MessageFns = { encode(message: RequestCancellationPolicy_Item, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.fR !== undefined && message.fR !== 0) { writer.uint32(8).int32(message.fR); } if (message.NK !== undefined && message.NK !== 0) { writer.uint32(16).int32(message.NK); } if (message.minReadaheadMs !== undefined && message.minReadaheadMs !== 0) { writer.uint32(24).int32(message.minReadaheadMs); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RequestCancellationPolicy_Item { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestCancellationPolicy_Item(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 8) { break; } message.fR = reader.int32(); continue; case 2: if (tag !== 16) { break; } message.NK = reader.int32(); continue; case 3: if (tag !== 24) { break; } message.minReadaheadMs = reader.int32(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): RequestCancellationPolicy_Item { return { fR: isSet(object.fR) ? globalThis.Number(object.fR) : 0, NK: isSet(object.NK) ? globalThis.Number(object.NK) : 0, minReadaheadMs: isSet(object.minReadaheadMs) ? globalThis.Number(object.minReadaheadMs) : 0, }; }, toJSON(message: RequestCancellationPolicy_Item): unknown { const obj: any = {}; if (message.fR !== undefined && message.fR !== 0) { obj.fR = Math.round(message.fR); } if (message.NK !== undefined && message.NK !== 0) { obj.NK = Math.round(message.NK); } if (message.minReadaheadMs !== undefined && message.minReadaheadMs !== 0) { obj.minReadaheadMs = Math.round(message.minReadaheadMs); } return obj; }, create, I>>(base?: I): RequestCancellationPolicy_Item { return RequestCancellationPolicy_Item.fromPartial(base ?? ({} as any)); }, fromPartial, I>>( object: I, ): RequestCancellationPolicy_Item { const message = createBaseRequestCancellationPolicy_Item(); message.fR = object.fR ?? 0; message.NK = object.NK ?? 0; message.minReadaheadMs = object.minReadaheadMs ?? 0; return message; }, }; type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; function isSet(value: any): boolean { return value !== null && value !== undefined; } export interface MessageFns { encode(message: T, writer?: BinaryWriter): BinaryWriter; decode(input: BinaryReader | Uint8Array, length?: number): T; fromJSON(object: any): T; toJSON(message: T): unknown; create, I>>(base?: I): T; fromPartial, I>>(object: I): T; }