# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: output.proto
# plugin: python-betterproto
# This file has been @generated

from dataclasses import dataclass
from datetime import datetime
from typing import (
    TYPE_CHECKING,
    AsyncIterable,
    AsyncIterator,
    Dict,
    Iterable,
    Iterator,
    Optional,
    Union,
)

import betterproto
import grpc
from betterproto.grpcstub.grpcio_client import SyncServiceStub
from betterproto.grpcstub.grpclib_server import ServiceBase


if TYPE_CHECKING:
    import grpclib.server
    from betterproto.grpcstub.grpclib_client import MetadataLike
    from grpclib.metadata import Deadline


@dataclass(eq=False, repr=False)
class OutputSaveRequest(betterproto.Message):
    task_id: str = betterproto.string_field(1)
    filename: str = betterproto.string_field(2)
    content: bytes = betterproto.bytes_field(3)


@dataclass(eq=False, repr=False)
class OutputSaveResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    err_msg: str = betterproto.string_field(2)
    id: str = betterproto.string_field(3)


@dataclass(eq=False, repr=False)
class OutputStatRequest(betterproto.Message):
    id: str = betterproto.string_field(1)
    task_id: str = betterproto.string_field(2)
    filename: str = betterproto.string_field(3)


@dataclass(eq=False, repr=False)
class OutputStat(betterproto.Message):
    mode: str = betterproto.string_field(1)
    size: int = betterproto.int64_field(2)
    atime: datetime = betterproto.message_field(3)
    mtime: datetime = betterproto.message_field(4)


@dataclass(eq=False, repr=False)
class OutputStatResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    err_msg: str = betterproto.string_field(2)
    stat: "OutputStat" = betterproto.message_field(3)


@dataclass(eq=False, repr=False)
class OutputPublicUrlRequest(betterproto.Message):
    id: str = betterproto.string_field(1)
    task_id: str = betterproto.string_field(2)
    filename: str = betterproto.string_field(3)
    expires: int = betterproto.uint32_field(4)


@dataclass(eq=False, repr=False)
class OutputPublicUrlResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    err_msg: str = betterproto.string_field(2)
    public_url: str = betterproto.string_field(3)


class OutputServiceStub(SyncServiceStub):
    def output_save_stream(
        self, output_save_request_iterator: Iterable["OutputSaveRequest"]
    ) -> "OutputSaveResponse":
        return (
            self._stream_unary(
                "/output.OutputService/OutputSaveStream",
                OutputSaveRequest,
                OutputSaveResponse,
            )
            .future(output_save_request_iterator)
            .result()
        )

    def output_stat(
        self, output_stat_request: "OutputStatRequest"
    ) -> "OutputStatResponse":
        return self._unary_unary(
            "/output.OutputService/OutputStat",
            OutputStatRequest,
            OutputStatResponse,
        )(output_stat_request)

    def output_public_url(
        self, output_public_url_request: "OutputPublicUrlRequest"
    ) -> "OutputPublicUrlResponse":
        return self._unary_unary(
            "/output.OutputService/OutputPublicURL",
            OutputPublicUrlRequest,
            OutputPublicUrlResponse,
        )(output_public_url_request)
