
    <%i                        d dl mZ d dlmZmZmZmZmZmZm	Z	 d dl
mZ d dlmZ erd dlmZ d dlmZ eeef   Z G d ded         Z G d	 d
ed
         Z G d ded         Z G d ded         Z G d ded         Zy)    )abstractmethod)TYPE_CHECKINGAnyDictListOptionalTypeUnion)OpenApiGeneratorExtension)	Direction)APIView)
AutoSchemac            
           e Zd ZU dZg Zeed       ed<   ee	ee	   f   ed<   dddee
e	ee   f   ee
e	ee   f      f   fdZedddeeee   f   fd       Zy	)
OpenApiAuthenticationExtensionaC  
    Extension for specifying authentication schemes.

    The common use-case usually consists of setting a ``name`` string and returning a dict from
    ``get_security_definition``. To model a group of headers that go together, set a list
    of names and return a corresponding list of definitions from ``get_security_definition``.

    The view class is available via ``auto_schema.view``, while the original authentication class
    can be accessed via ``self.target``. If you want to override an included extension, be sure to
    set a higher matching priority by setting the class attribute ``priority = 1`` or higher.

    get_security_requirement is expected to return a dict with security object names as keys and a
    scope list as value (usually just []). More than one key in the dict means that each entry is
    required (AND). If you need alternate variations (OR), return a list of those dicts instead.

    ``get_security_definition()`` is expected to return a valid `OpenAPI security scheme object
    <https://spec.openapis.org/oas/v3.0.3#security-scheme-object>`_
    	_registrynameauto_schemar   returnc                     | j                   sJ d       t        | j                   t              r| j                   g iS | j                   D ci c]  }|g  c}S c c}w )Nzname(s) must be specified)r   
isinstancestr)selfr   r   s      R/usr/local/footviz/venv/lib/python3.12/site-packages/drf_spectacular/extensions.pyget_security_requirementz7OpenApiAuthenticationExtension.get_security_requirement'   sN     yy555ydii%IIr?")-3D"H333s   

Ac                      y N )r   r   s     r   get_security_definitionz6OpenApiAuthenticationExtension.get_security_definition0           N)__name__
__module____qualname____doc__r   r   r	   __annotations__r
   r   r   r   r   r   _SchemaTyper   r   r    r   r   r      s    $ ?AItD9:;@
T#Y
4+4	tCcN#T$sDI~*>%??	@4 < E+W[\gWhJhDi  r    r   c                   n    e Zd ZU dZg Zeed       ed<   dddede	e
   fdZdddedefdZdddedefd	Zy
)OpenApiSerializerExtensiona  
    Extension for replacing an insufficient or specifying an unknown Serializer schema.

    The existing implementation of ``map_serializer()`` will generate the same result
    as *drf-spectacular* would. Either augment or replace the generated schema. The
    view instance is available via ``auto_schema.view``, while the original serializer
    can be accessed via ``self.target``.

    ``map_serializer()`` is expected to return a valid `OpenAPI schema object
    <https://spec.openapis.org/oas/v3.0.3#schema-object>`_.
    r   r   r   	directionr   c                      y)z3 return str for overriding default name extraction Nr   r   r   r)   s      r   get_namez#OpenApiSerializerExtension.get_nameC       r    c                      y)zQ return anything to compare instances of target. Target will be used by default. Nr   r+   s      r   get_identityz'OpenApiSerializerExtension.get_identityG   r-   r    c                 >    |j                  | j                  |d      S )z, override for customized serializer mapping T)bypass_extensions)_map_serializertarget_classr+   s      r   map_serializerz)OpenApiSerializerExtension.map_serializerK   s!    **4+<+<i[_*``r    N)r!   r"   r#   r$   r   r   r	   r%   r   r   r   r,   r   r/   r&   r4   r   r    r   r(   r(   5   sv    
 ;=ItD567<L Y 8TW=   s a, a9 aQ\ ar    r(   c                   \    e Zd ZU dZg Zeed       ed<   dee	   fdZ
edddedefd       Zy	)
OpenApiSerializerFieldExtensiona<  
    Extension for replacing an insufficient or specifying an unknown SerializerField schema.

    To augment the default schema, you can get what *drf-spectacular* would generate with
    ``auto_schema._map_serializer_field(self.target, direction, bypass_extensions=True)``.
    and edit the returned schema at your discretion. Beware that this may still emit
    warnings, in which case manual construction is advisable.

    ``map_serializer_field()`` is expected to return a valid `OpenAPI schema object
    <https://spec.openapis.org/oas/v3.0.3#schema-object>`_.
    r   r   c                      y)zH return str for breaking out field schema into separate named component Nr   r   s    r   r,   z(OpenApiSerializerFieldExtension.get_name^   r-   r    r   r   r)   c                      y)z2 override for customized serializer field mapping Nr   r+   s      r   map_serializer_fieldz4OpenApiSerializerFieldExtension.map_serializer_fieldb   s     	r    N)r!   r"   r#   r$   r   r   r	   r%   r   r   r,   r   r   r&   r:   r   r    r   r6   r6   P   sZ    
 @BItD:;<A(3-    Wb  r    r6   c                   v     e Zd ZU dZg Zeed       ed<    fdZe	 fd       Z
e	dd       Zedd       Z xZS )	OpenApiViewExtensiona  
    Extension for replacing discovered views with a more schema-appropriate/annotated version.

    ``view_replacement()`` is expected to return a subclass of ``APIView`` (which includes
    ``ViewSet`` et al.). The discovered original view callback can be accessed with
    ``self.target_callback``, while the discovered original view class can be accessed
    with ``self.target`` and can be subclassed if desired.
    r   c                 F    t         |   |j                         || _        y r   )super__init__clstarget_callback)r   rA   	__class__s     r   r?   zOpenApiViewExtension.__init__s   s    ,,-.r    c                     t         |           t        | j                  d      r| j                  j                  | _        y y )Nr@   )r>   _load_classhasattrr3   r@   )r@   rB   s    r   rD   z OpenApiViewExtension._load_classw   s7    3##U+"//33C ,r    c                     t        | j                  d d      D ]'  }|j                  |j                        s ||      c S  y )Nc                     | j                   S r   )priority)es    r   <lambda>z0OpenApiViewExtension.get_match.<locals>.<lambda>   s
    QZZ r    T)keyreverse)sortedr   _matchesr@   )r@   rA   	extensions      r   	get_matchzOpenApiViewExtension.get_match~   sD    3GQUV 	2I!!/"5"56 11	2 r    c                      y r   r   r8   s    r   view_replacementz%OpenApiViewExtension.view_replacement   r   r    )r   zOptional[OpenApiViewExtension])r   zType[APIView])r!   r"   r#   r$   r   r   r	   r%   r?   classmethodrD   rP   r   rR   __classcell__)rB   s   @r   r<   r<   h   s`     57ItD/016/ 4 4    r    r<   c                   L    e Zd ZU dZg Zeed       ed<   edddee	   fd       Z
y)OpenApiFilterExtensiona.  
    Extension for specifying a list of filter parameters for a given ``FilterBackend``.

    The original filter class object can be accessed via ``self.target``. The attached view
    is accessible via ``auto_schema.view``.

    ``get_schema_operation_parameters()`` is expected to return either an empty list or a list
    of valid raw `OpenAPI parameter objects
    <https://spec.openapis.org/oas/v3.0.3#parameter-object>`_.
    Using ``drf_spectacular.plumbing.build_parameter_type`` is recommended to generate
    the appropriate raw dict objects.
    r   r   r   r   c                      y r   r   )r   r   argskwargss       r   get_schema_operation_parametersz6OpenApiFilterExtension.get_schema_operation_parameters   r   r    N)r!   r"   r#   r$   r   r   r	   r%   r   r&   rZ   r   r    r   rV   rV      sE     79ItD1238< ]abm]n  r    rV   N)abcr   typingr   r   r   r   r   r	   r
   drf_spectacular.plumbingr   drf_spectacular.utilsr   rest_framework.viewsr   drf_spectacular.openapir   r   r&   r   r(   r6   r<   rV   r   r    r   <module>ra      s     H H H > +,2 38n"%>?_%` "Ja!:;W!X a6&?@a&b 045KL D67OP r    