# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# See https://github.com/eolymp/contracts/tree/main/cmd/protoc-gen-python-esdk for more details.
"""Generated protocol buffer code."""

import urllib.parse
from google.protobuf import symbol_database as _symbol_database

_sym_db = _symbol_database.Default()


class EntryServiceClient:
    def __init__(self, transport, url="https://api.eolymp.com"):
        self.transport = transport
        self.url = url

    def CreateEntry(self, request, **kwargs):
        path = "/entries"

        return self.transport.request(
            method="POST",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.course.CreateEntryOutput"),
            **kwargs,
        )

    def UpdateEntry(self, request, **kwargs):
        path = "/entries/"+urllib.parse.quote(request.entry_id)

        # Cleanup URL parameters to avoid any ambiguity
        request.entry_id = ""

        return self.transport.request(
            method="PUT",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.course.UpdateEntryOutput"),
            **kwargs,
        )

    def RenameEntry(self, request, **kwargs):
        path = "/entries/"+urllib.parse.quote(request.entry_id)+"/title"

        # Cleanup URL parameters to avoid any ambiguity
        request.entry_id = ""

        return self.transport.request(
            method="PUT",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.course.RenameEntryOutput"),
            **kwargs,
        )

    def MoveEntry(self, request, **kwargs):
        path = "/entries/"+urllib.parse.quote(request.entry_id)+"/position"

        # Cleanup URL parameters to avoid any ambiguity
        request.entry_id = ""

        return self.transport.request(
            method="PUT",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.course.MoveEntryOutput"),
            **kwargs,
        )

    def DeleteEntry(self, request, **kwargs):
        path = "/entries/"+urllib.parse.quote(request.entry_id)

        # Cleanup URL parameters to avoid any ambiguity
        request.entry_id = ""

        return self.transport.request(
            method="DELETE",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.course.DeleteEntryOutput"),
            **kwargs,
        )

    def DescribeEntry(self, request, **kwargs):
        path = "/entries/"+urllib.parse.quote(request.entry_id)

        # Cleanup URL parameters to avoid any ambiguity
        request.entry_id = ""

        return self.transport.request(
            method="GET",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.course.DescribeEntryOutput"),
            **kwargs,
        )

    def ListEntries(self, request, **kwargs):
        path = "/entries"

        return self.transport.request(
            method="GET",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.course.ListEntriesOutput"),
            **kwargs,
        )

    def DescribeTree(self, request, **kwargs):
        path = "/toc"

        return self.transport.request(
            method="GET",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.course.DescribeTreeOutput"),
            **kwargs,
        )

    def ListParents(self, request, **kwargs):
        path = "/entries/"+urllib.parse.quote(request.entry_id)+"/parents"

        # Cleanup URL parameters to avoid any ambiguity
        request.entry_id = ""

        return self.transport.request(
            method="GET",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.course.ListParentsOutput"),
            **kwargs,
        )

