import pandas as pd
from _typeshed import Incomplete as Incomplete
from pathlib import Path
from rdetoolkit.models.rde2types import RdeOutputResourcePath as RdeOutputResourcePath
from typing import Any, Optional, Union

def read_excelinvoice(excelinvoice_filepath) -> None: ...
def check_exist_rawfiles(dfexcelinvoice: pd.DataFrame, excel_rawfiles: list[Path]) -> list[Path]: ...
def overwrite_invoicefile_for_dpfterm(invoiceobj, invoice_dst_filepath, invoiceschema_filepath, invoice_info) -> None: ...
def check_exist_rawfiles_for_folder(dfexcelinvoice, rawfiles_tpl) -> None: ...

class InvoiceFile:
    invoice_path: Incomplete
    invoice_obj: Incomplete
    def __init__(self, invoice_path: Path) -> None: ...
    invoice_json: Incomplete
    def read(self, *, target_path: Optional[Path] = ...) -> dict: ...
    def overwrite(self, dst_file_path: Path, *, src_file_path: Optional[Path] = ...): ...

class ExcelInvoiceFile:
    invoice_path: Incomplete
    def __init__(self, invoice_path: Path) -> None: ...
    def read(self, *, target_path: Optional[Path] = ...) -> tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: ...
    def overwrite(self, invoice_org: Path, dist_path: Path, invoice_schema_path: Path, idx: int) -> None: ...

def backup_invoice_json_files(excel_invoice_file: Optional[Path], mode: Optional[str]) -> Path: ...
def update_description_with_features(rde_resource: RdeOutputResourcePath, dst_invoice_json: Path, metadata_def_json: Path): ...

class RuleBasedReplacer:
    rules: Incomplete
    last_apply_result: Incomplete
    def __init__(self, *, rule_file_path: Optional[Union[str, Path]] = ...) -> None: ...
    def load_rules(self, filepath: Union[str, Path]) -> None: ...
    def get_apply_rules_obj(self, replacements: dict[str, Any], source_json_obj: Optional[dict[str, Any]], *, mapping_rules: Optional[dict[str, str]] = ...) -> dict[str, Any]: ...
    def set_rule(self, path: str, variable: str) -> None: ...
    def write_rule(self, replacements_rule: dict[str, Any], save_file_path: Union[str, Path]) -> str: ...

def apply_default_filename_mapping_rule(replacement_rule: dict[str, Any], save_file_path: Union[str, Path]) -> dict[str, Any]: ...
def apply_magic_variable(invoice_path: Union[str, Path], rawfile_path: Union[str, Path], *, save_filepath: Optional[Union[str, Path]] = ...) -> dict[str, Any]: ...
