from __future__ import annotations

import unittest

from govoplan_core.core.distribution_lists import (
    CAPABILITY_DISTRIBUTION_LIST_EXPAND,
    DistributionExpansionLimits,
    DistributionExpansionRequest,
    DistributionListEntryRef,
    DistributionSourceReference,
)


class DistributionListContractTests(unittest.TestCase):
    def test_mixed_entry_and_bounded_request_are_provider_neutral(self) -> None:
        source = DistributionSourceReference(
            provider="addresses",
            resource_type="address_list",
            resource_id="list-1",
            revision="4",
            fingerprint="sha256:abc",
        )
        entry = DistributionListEntryRef(
            id="entry-1",
            kind="address_list",
            mode="include",
            source=source,
            requested_channels=("email",),
        )
        request = DistributionExpansionRequest(
            list_id="distribution-1",
            limits=DistributionExpansionLimits(max_results=25),
        )

        self.assertEqual("address_list", entry.kind)
        self.assertEqual(25, request.limits.max_results)
        self.assertEqual("dist_lists.expand", CAPABILITY_DISTRIBUTION_LIST_EXPAND)


if __name__ == "__main__":
    unittest.main()
