"""Testes do módulo config."""

import pytest
from tecjustica_ocr.config import OcrConfig


def test_defaults():
    config = OcrConfig()
    assert config.model == "mobile"
    assert config.device == "auto"
    assert config.scale == 2
    assert config.mode == "text"
    assert config.min_score == 0.5
    assert config.workers >= 1


def test_invalid_model():
    with pytest.raises(ValueError, match="model"):
        OcrConfig(model="invalid")


def test_invalid_mode():
    with pytest.raises(ValueError, match="mode"):
        OcrConfig(mode="invalid")


def test_invalid_scale():
    with pytest.raises(ValueError, match="scale"):
        OcrConfig(scale=5)


def test_custom_values():
    config = OcrConfig(model="server", scale=3, mode="structure", min_score=0.8)
    assert config.model == "server"
    assert config.scale == 3
    assert config.mode == "structure"
    assert config.min_score == 0.8
