ACCEPTED_MIME_TYPES = frozenset(["image/jpeg", "image/png", "image/gif", "image/webp"])


class MimeTypeError(ValueError):
    pass


class FileSizeError(ValueError):
    pass


def validate_mime_type(mime_type: str) -> None:
    if mime_type not in ACCEPTED_MIME_TYPES:
        raise MimeTypeError(f"Unsupported MIME type: {mime_type}")


def validate_file_size(size_bytes: int, max_bytes: int) -> None:
    if size_bytes <= 0:
        raise FileSizeError("File must not be empty")
    if size_bytes > max_bytes:
        raise FileSizeError(f"File size {size_bytes} exceeds limit of {max_bytes} bytes")
