1 package civitas.common.mix.revelation;
2
3 import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.stereotype.Controller;
5
6 import civitas.common.CommonConstants;
7 import civitas.common.election.ElectionDetails;
8 import civitas.common.election.GetBlockName;
9 import jakarta.annotation.Nonnull;
10
11 @Controller
12 public class GetMixRevelationMeta implements CommonConstants {
13
14 @Autowired
15 GetBlockName getBlockName;
16
17 public String apply(
18 @Nonnull final ElectionDetails electionDetails,
19 final boolean isVoteMix,
20 final int block,
21 final int tellerIndex) {
22 if (null == electionDetails) {
23 throw new NullPointerException();
24 }
25
26 String blockDesc = getBlockName.apply(electionDetails, block);
27 return MIX_REVELATION_META_PREFIX
28 + (isVoteMix ? MIX_REVELATION_META_VOTE_REVELATION : MIX_REVELATION_META_ER_REVELATION)
29 + ":" + blockDesc + ":" + tellerIndex;
30 }
31 }