from datetime import datetime

from lxml.etree import Element
from lxml.objectify import ObjectifiedElement
from pykeepass.attachment import Attachment
from pykeepass.baseelement import BaseElement
from pykeepass.group import Group
from pykeepass.pykeepass import PyKeePass

class Entry(BaseElement):
    def __init__(
        self,
        title: str | None = None,
        username: str | None = None,
        password: str | None = None,
        url: str | None = None,
        notes: str | None = None,
        otp: str | None = None,
        tags: list[str] | str | None = None,
        expires: bool = False,
        expiry_time: datetime | None = None,
        icon: str | None = None,
        autotype_sequence: str | None = None,
        autotype_enabled: bool = True,
        autotype_window: str | None = None,
        element: Element | ObjectifiedElement | None = None,
        kp: PyKeePass | None = None,
    ) -> None: ...
    @property
    def index(self) -> int: ...
    def reindex(self, new_index: int) -> None: ...
    @property
    def attachments(self) -> list[Attachment]: ...
    def add_attachment(self, id: int, filename: str) -> Attachment: ...
    def delete_attachment(self, attachment: Attachment) -> None: ...
    def deref(self, attribute: str) -> str | None: ...
    @property
    def title(self) -> str | None: ...
    @title.setter
    def title(self, value: str | None) -> None: ...
    @property
    def username(self) -> str | None: ...
    @username.setter
    def username(self, value: str | None) -> None: ...
    @property
    def password(self) -> str | None: ...
    @password.setter
    def password(self, value: str | None) -> None: ...
    @property
    def url(self) -> str | None: ...
    @url.setter
    def url(self, value: str | None) -> None: ...
    @property
    def notes(self) -> str | None: ...
    @notes.setter
    def notes(self, value: str | None) -> None: ...
    @property
    def otp(self) -> str | None: ...
    @otp.setter
    def otp(self, value: str | None) -> None: ...
    @property
    def tags(self) -> list[str]: ...
    @tags.setter
    def tags(self, value: list[str] | str) -> None: ...
    @property
    def history(self) -> list[HistoryEntry]: ...
    @property
    def autotype_enabled(self) -> bool | None: ...
    @autotype_enabled.setter
    def autotype_enabled(self, value: bool | None) -> None: ...
    @property
    def autotype_sequence(self) -> str | None: ...
    @autotype_sequence.setter
    def autotype_sequence(self, value: str | None) -> None: ...
    @property
    def autotype_window(self) -> str | None: ...
    @autotype_window.setter
    def autotype_window(self, value: str | None) -> None: ...
    @property
    def is_a_history_entry(self) -> bool: ...
    @property
    def path(self) -> list[str | None] | None: ...
    @property
    def custom_properties(self) -> dict[str, str | None]: ...
    def set_custom_property(
        self, key: str, value: str, protect: bool = False
    ) -> None: ...
    def get_custom_property(self, key: str) -> str | None: ...
    def delete_custom_property(self, key: str) -> None: ...
    def is_custom_property_protected(self, key: str) -> bool: ...
    def ref(self, attribute: str) -> str: ...
    def save_history(self) -> None: ...
    def delete_history(
        self, history_entry: Entry | None = None, all: bool = False
    ) -> None: ...
    @property
    def group(self) -> Group | None: ...
    @property
    def parentgroup(self) -> Group | None: ...
    def __str__(self) -> str: ...

class HistoryEntry(Entry):
    def __str__(self) -> str: ...
    def __hash__(self) -> int: ...
