
    Wwg                         d dl mZ d dlmZ d dlmZmZmZ d dlm	Z	 d dl
mZmZ d dlmZmZ g dZe G d d	e	             Z G d
 de      Z ed       G d d             Z G d d      Zy)    )	dataclass)unique)OptionalSetUnion)OrderedEnum)HistoricalResolverPdfFileReader)FieldMDPSpecMDPPerm)ModificationLevelSuspiciousModification
DiffResult
DiffPolicyc                   ,    e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZy)r   a  
    Records the (semantic) modification level of a document.

    Compare :class:`~.pyhanko.sign.fields.MDPPerm`, which records the document
    modification policy associated with a particular signature, as opposed
    to the empirical judgment indicated by this enum.
    r               N)	__name__
__module____qualname____doc__NONELTA_UPDATESFORM_FILLINGANNOTATIONSOTHER     \/var/www/horilla/myenv/lib/python3.12/site-packages/pyhanko/sign/diff_analysis/policy_api.pyr   r      sC     D K	 L
 K Er    r   c                       e Zd ZdZy)r   z*Error indicating a suspicious modificationN)r   r   r   r   r   r    r!   r   r   E   s    4r    r   T)frozenc                   .    e Zd ZU dZeed<   	 ee   ed<   y)r   zs
    Encodes the result of a difference analysis on two revisions.

    Returned by :meth:`.DiffPolicy.apply`.
    modification_levelchanged_form_fieldsN)r   r   r   r   r   __annotations__r   strr   r    r!   r   r   K   s%     *) S!r    r   c                       e Zd ZdZ	 	 ddededee   dee   def
dZ		 	 dd	e
d
eeef   dee   dee   deeef   f
dZy)r   z8
    Analyse the differences between two revisions.
    Noldnewfield_mdp_specdoc_mdpreturnc                     t         )a  
        Execute the policy on a pair of revisions, with the MDP values provided.
        :class:`.SuspiciousModification` exceptions should be propagated.

        :param old:
            The older, base revision.
        :param new:
            The newer revision.
        :param field_mdp_spec:
            The field MDP spec that's currently active.
        :param doc_mdp:
            The DocMDP spec that's currently active.
        :return:
            A :class:`.DiffResult` object summarising the policy's judgment.
        NotImplementedError)selfr*   r+   r,   r-   s        r!   applyzDiffPolicy.applyh   s
    , "!r    readerbase_revisionc                     t         )a  
        Compare the current state of a file to an earlier version,
        with the MDP values provided.
        :class:`.SuspiciousModification` exceptions should be propagated.

        If there are multiple revisions between the base revision and the
        current one, the precise manner in which the review is conducted
        is left up to the implementing class. In particular,
        subclasses may choose to review each intermediate revision individually,
        or handle them all at once.

        :param reader:
            PDF reader representing the current state of the file.
        :param base_revision:
            The older, base revision. You can choose between providing it as a
            revision index, or a :class:`.HistoricalResolver` instance.
        :param field_mdp_spec:
            The field MDP spec that's currently active.
        :param doc_mdp:
            The DocMDP spec that's currently active.
        :return:
            A :class:`.DiffResult` object summarising the policy's judgment.
        r0   )r2   r4   r5   r,   r-   s        r!   review_filezDiffPolicy.review_file   s
    < "!r    )NN)r   r   r   r   r	   r   r   r   r   r3   r
   r   intr   r7   r   r    r!   r   r   c   s     26%)""  " !.	"
 '"" 
"8 26%)"" S"445" !.	"
 '"" 
z11	2"r    r   N)dataclassesr   enumr   typingr   r   r   pyhanko.pdf_utils.miscr   pyhanko.pdf_utils.readerr	   r
   pyhanko.sign.fieldsr   r   __all__r   
ValueErrorr   r   r   r   r    r!   <module>rA      sq    !  ' ' . F 5 0 0 0f	Z 	 $  .;" ;"r    