import os
import glob
from bs4 import BeautifulSoup

def check_site(site_dir):
    print(f"\nChecking {site_dir}...")
    html_files = glob.glob(f"{site_dir}/**/*.html", recursive=True)
    for f in html_files:
        with open(f, 'r', encoding='utf-8') as file:
            content = file.read()
            soup = BeautifulSoup(content, 'html.parser')
            
            title = soup.title.string if soup.title else None
            meta_desc = soup.find('meta', attrs={'name': 'description'})
            desc_content = meta_desc['content'] if meta_desc and meta_desc.has_attr('content') else None
            
            links = soup.find_all('a')
            internal_links = [link['href'] for link in links if link.has_attr('href') and not link['href'].startswith('http')]
            
            wa_btn = soup.find('a', class_='whatsapp-btn')
            has_wa = wa_btn is not None
            
            print(f"{os.path.basename(f)}: Title: {'OK' if title else 'MISSING'} | Desc: {'OK' if desc_content else 'MISSING'} | Internal Links: {len(internal_links)} | WA: {'YES' if has_wa else 'NO'}")

check_site('tostum')
check_site('chef-kamil')
