"""New strict parser interface, not an invented recovered production handler."""
from pathlib import Path
from datamine_adapter import parse_timesales,MAX_FILE
from infinbot_common import Rejected

class CMEDataMineParser:
    def __init__(self,product):self.product=product
    def validate(self,path,*,header=True):
        p=Path(path)
        if p.is_symlink() or not p.is_file() or p.stat().st_size>MAX_FILE:raise Rejected('Bounded existing DataMine file required')
        return parse_timesales(p.read_bytes(),self.product,header=header)
