"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var ChallengeResultsChart_1 = require("../ChallengeResultsChart");
var constants_1 = require("./constants");
var ListingHistoryEvent_1 = require("./ListingHistoryEvent");
exports.ChallengeSucceededEvent = function (props) {
    var totalVotes = props.totalVotes, votesFor = props.votesFor, votesAgainst = props.votesAgainst, percentFor = props.percentFor, percentAgainst = props.percentAgainst, didChallengeOriginallySucceed = props.didChallengeOriginallySucceed, appealRequested = props.appealRequested, appealGranted = props.appealGranted, appealChallengeTotalVotes = props.appealChallengeTotalVotes, appealChallengeVotesFor = props.appealChallengeVotesFor, appealChallengeVotesAgainst = props.appealChallengeVotesAgainst, appealChallengePercentFor = props.appealChallengePercentFor, appealChallengePercentAgainst = props.appealChallengePercentAgainst, didAppealChallengeSucceed = props.didAppealChallengeSucceed;
    var councilDecision;
    var councilContext;
    if (appealRequested) {
        if (appealGranted) {
            councilDecision = didChallengeOriginallySucceed ? "approve" : "reject";
            councilContext = "overturn";
        }
        else {
            councilDecision = didChallengeOriginallySucceed ? "reject" : "approve";
            councilContext = "uphold";
        }
    }
    return (React.createElement(ListingHistoryEvent_1.ListingHistoryEvent, { title: constants_1.ListingEventTitles.CHALLENGE_SUCCEEDED, timestamp: props.timestamp },
        React.createElement(ChallengeResultsChart_1.ChallengeResults, { headerText: "Newsroom removed from registry", totalVotes: totalVotes, votesFor: votesFor, votesAgainst: votesAgainst, percentFor: percentFor, percentAgainst: percentAgainst, didChallengeSucceed: didChallengeOriginallySucceed }),
        councilDecision && (React.createElement("p", null,
            React.createElement("b", null,
                "The Civil Council decided to ",
                councilDecision,
                " this Newsroom, ",
                councilContext,
                "ing the Civil Community's vote"))),
        appealChallengeTotalVotes && (React.createElement(ChallengeResultsChart_1.ChallengeResults, { noHeader: true, isAppealChallenge: true, totalVotes: appealChallengeTotalVotes, votesFor: appealChallengeVotesFor, votesAgainst: appealChallengeVotesAgainst, percentFor: appealChallengePercentFor, percentAgainst: appealChallengePercentAgainst, didChallengeSucceed: didAppealChallengeSucceed }))));
};
//# sourceMappingURL=ChallengeSucceededEvent.js.map