# Path: openprocurement/tender/openeu/validation.py
# def validate_view_bids_in_active_tendering(request):
#     if request.validated['tender_status'] == 'active.tendering':
#         raise_operation_error(request, 'Can\'t view {} in current ({}) tender status'.format('bid' if request.matchdict.get('bid_id') else 'bids', request.validated['tender_status']))


from openprocurement.api.utils import (
    json_view,
    context_unpack,
    get_now,
)
from openprocurement.tender.core.utils import (
    optendersresource,
    apply_patch,
    save_tender
)
from openprocurement.tender.core.validation import (
    validate_patch_bid_data,
    validate_update_deleted_bid,
    validate_bid_operation_period,
    validate_bid_operation_not_in_tendering,
    validate_bid_status_update_not_to_pending
)
from openprocurement.tender.openua.views.bid import (
    TenderUABidResource as BaseResource
)
from openprocurement.tender.openeu.validation import validate_view_bids_in_active_tendering

        Example request for retrieving the proposal:

        .. sourcecode:: http

            GET /tenders/4879d3f8ee2443169b5fbbc9f89fa607/bids/71b6c23ed8944d688e92a31ec8c3f61a HTTP/1.1
            Host: example.com
            Accept: application/json

        And here is the response to be expected:

        .. sourcecode:: http

            HTTP/1.0 200 OK
            Content-Type: application/json

            {
                "data": {
                    "value": {
                        "amount": 600,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    }
                }
            }

        """
        if self.request.authenticated_role == 'bid_owner':
            return {'data': self.request.context.serialize('view')}
        # TODO can't move this validator becacuse of check above

# Path: openprocurement/tender/openeu/validation.py
# def validate_view_bids_in_active_tendering(request):
#     if request.validated['tender_status'] == 'active.tendering':
#         raise_operation_error(request, 'Can\'t view {} in current ({}) tender status'.format('bid' if request.matchdict.get('bid_id') else 'bids', request.validated['tender_status']))


# Path: openprocurement/tender/openeu/views/bid.py
from openprocurement.api.utils import (
    json_view,
    context_unpack,
    get_now,
)
from openprocurement.tender.core.utils import (
    optendersresource,
    apply_patch,
    save_tender
)
from openprocurement.tender.core.validation import (
    validate_patch_bid_data,
    validate_update_deleted_bid,
    validate_bid_operation_period,
    validate_bid_operation_not_in_tendering,
    validate_bid_status_update_not_to_pending
)
from openprocurement.tender.openua.views.bid import (
    TenderUABidResource as BaseResource
)
from openprocurement.tender.openeu.validation import validate_view_bids_in_active_tendering


        Example request for retrieving the proposal:

        .. sourcecode:: http

            GET /tenders/4879d3f8ee2443169b5fbbc9f89fa607/bids/71b6c23ed8944d688e92a31ec8c3f61a HTTP/1.1
            Host: example.com
            Accept: application/json

        And here is the response to be expected:

        .. sourcecode:: http

            HTTP/1.0 200 OK
            Content-Type: application/json

            {
                "data": {
                    "value": {
                        "amount": 600,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    }
                }
            }

        """
        if self.request.authenticated_role == 'bid_owner':
            return {'data': self.request.context.serialize('view')}
        # TODO can't move this validator becacuse of check above

        validate_view_bids_in_active_tendering(self.request)