# coding: utf-8

"""
    HashiCorp Vault API

    HTTP API that gives you full access to Vault. All API routes are prefixed with `/v1/`.

    The version of the OpenAPI document: 1.15.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class TransitVerifyWithAlgorithmRequest(BaseModel):
    """
    TransitVerifyWithAlgorithmRequest
    """ # noqa: E501
    algorithm: Optional[StrictStr] = Field(default='sha2-256', description="Deprecated: use \"hash_algorithm\" instead.")
    batch_input: Optional[List[Dict[str, Any]]] = Field(default=None, description="Specifies a list of items for processing. When this parameter is set, any supplied 'input', 'hmac' or 'signature' parameters will be ignored. Responses are returned in the 'batch_results' array component of the 'data' element of the response. Any batch output will preserve the order of the batch input")
    context: Optional[StrictStr] = Field(default=None, description="Base64 encoded context for key derivation. Required if key derivation is enabled; currently only available with ed25519 keys.")
    hash_algorithm: Optional[StrictStr] = Field(default='sha2-256', description="Hash algorithm to use (POST body parameter). Valid values are: * sha1 * sha2-224 * sha2-256 * sha2-384 * sha2-512 * sha3-224 * sha3-256 * sha3-384 * sha3-512 * none Defaults to \"sha2-256\". Not valid for all key types. See note about none on signing path.")
    hmac: Optional[StrictStr] = Field(default=None, description="The HMAC, including vault header/key version")
    input: Optional[StrictStr] = Field(default=None, description="The base64-encoded input data to verify")
    marshaling_algorithm: Optional[StrictStr] = Field(default='asn1', description="The method by which to unmarshal the signature when verifying. The default is 'asn1' which is used by openssl and X.509; can also be set to 'jws' which is used for JWT signatures in which case the signature is also expected to be url-safe base64 encoding instead of standard base64 encoding. Currently only valid for ECDSA P-256 key types\".")
    prehashed: Optional[StrictBool] = Field(default=None, description="Set to 'true' when the input is already hashed. If the key type is 'rsa-2048', 'rsa-3072' or 'rsa-4096', then the algorithm used to hash the input should be indicated by the 'algorithm' parameter.")
    salt_length: Optional[StrictStr] = Field(default='auto', description="The salt length used to sign. Currently only applies to the RSA PSS signature scheme. Options are 'auto' (the default used by Golang, causing the salt to be as large as possible when signing), 'hash' (causes the salt length to equal the length of the hash used in the signature), or an integer between the minimum and the maximum permissible salt lengths for the given RSA key size. Defaults to 'auto'.")
    signature: Optional[StrictStr] = Field(default=None, description="The signature, including vault header/key version")
    signature_algorithm: Optional[StrictStr] = Field(default=None, description="The signature algorithm to use for signature verification. Currently only applies to RSA key types. Options are 'pss' or 'pkcs1v15'. Defaults to 'pss'")
    __properties: ClassVar[List[str]] = ["algorithm", "batch_input", "context", "hash_algorithm", "hmac", "input", "marshaling_algorithm", "prehashed", "salt_length", "signature", "signature_algorithm"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of TransitVerifyWithAlgorithmRequest from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of TransitVerifyWithAlgorithmRequest from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "algorithm": obj.get("algorithm") if obj.get("algorithm") is not None else 'sha2-256',
            "batch_input": obj.get("batch_input"),
            "context": obj.get("context"),
            "hash_algorithm": obj.get("hash_algorithm") if obj.get("hash_algorithm") is not None else 'sha2-256',
            "hmac": obj.get("hmac"),
            "input": obj.get("input"),
            "marshaling_algorithm": obj.get("marshaling_algorithm") if obj.get("marshaling_algorithm") is not None else 'asn1',
            "prehashed": obj.get("prehashed"),
            "salt_length": obj.get("salt_length") if obj.get("salt_length") is not None else 'auto',
            "signature": obj.get("signature"),
            "signature_algorithm": obj.get("signature_algorithm")
        })
        return _obj


