from pathlib import Path
import sys
root=Path(__file__).resolve().parents[2]
checks={
'MASFileDropZone.vb':['Public Event BrowseRequested As EventHandler','Public Event FilesChanged As EventHandler','Private _multipleSelection As Boolean = True','Public Function AcceptDroppedFiles(paths As IEnumerable(Of String)) As Integer','Public Function SetFiles(paths As IEnumerable(Of String)) As MASFileDropZone','Public Function RemoveFileAt(index As Integer) As MASFileDropZone','Public Function ClearFiles() As MASFileDropZone'],
'MASFileDropZone.FileState.vb':['"Empty path"','"Only one file is allowed"','"File limit reached"','"Already added"','"File type not allowed"','StringComparison.OrdinalIgnoreCase'],
'MASFileDropZone.Interaction.vb':['Case Keys.Enter, Keys.Space','Case Keys.Delete, Keys.Back'],
'FileDropZoneTokens.vb':['Friend Const MaxPreviewRows As Integer = 4','Friend Const MaxStoredFiles As Integer = 64','Friend Const DefaultTitle As String = "Drop files here"','Friend Const PreferredWidthDip As Single = 620.0F','Friend Const MinWidthDip As Single = 340.0F'],
'MASApplicationWindowControls.ControlFactory.Media.vb':['Public Function AddFileDropZone(Optional title As String = Nothing']}
files=list(root.rglob('*.vb'))
passed=0
for name, snippets in checks.items():
    matches=[p for p in files if p.name==name]
    if not matches:
        print('FAIL missing',name);sys.exit(1)
    text='\n'.join(p.read_text(errors='ignore') for p in matches)
    for snippet in snippets:
        if snippet not in text:
            print('FAIL',name,snippet);sys.exit(1)
        passed+=1
idx=(root/'docs/reference/api/all-public-types-index.md').read_text(errors='ignore')
if '| `MASFileDropZone` | Class | Advanced |' not in idx:
    print('FAIL classification');sys.exit(1)
passed+=1
for rel in ['docs/reference/controls/file-drop-zone.md','docs/reference-guide.md','docs/user/controls.md']:
    if not (root/rel).exists(): print('FAIL missing doc',rel);sys.exit(1)
print(f'Assertions: {passed} passed, 0 failed')
