def generate_voting_blocks(deployment_id: int, message: str, approve_count: int, reject_count: int, voting_enabled: bool): blocks = [ { "type": "header", "text": { "type": "plain_text", "text": f"Voting | Deployment #{deployment_id}" } }, { "type": "section", "text": { "type": "mrkdwn", "text": f"*Message:*\n> {message}" } }, { "type": "section", "text": { "type": "mrkdwn", "text": f"*Votes:*\n> Approve: {approve_count}\n> Reject: {reject_count}" } }, ] if voting_enabled: blocks.append({ "type": "actions", "elements": [ { "type": "button", "text": {"type": "plain_text", "text": "Approve ^_^"}, "style": "primary", "action_id": f"vote_approve_{deployment_id}" }, { "type": "button", "text": {"type": "plain_text", "text": "Reject T_T"}, "style": "danger", "action_id": f"vote_reject_{deployment_id}" } ] }) return blocks