"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = tslib_1.__importDefault(require("react"));
const material_1 = require("@mui/material");
const styles_1 = require("@mui/material/styles");
const classnames_1 = tslib_1.__importDefault(require("classnames"));
const VoteButton_1 = tslib_1.__importDefault(require("../../../VoteButton"));
const VoteAudienceButton_1 = tslib_1.__importDefault(require("../../../VoteAudienceButton"));
const constants_1 = require("../../constants");
const classes = {
    root: `${constants_1.PREFIX}-action-vote-root`,
    divider: `${constants_1.PREFIX}-action-vote-divider`,
    button: `${constants_1.PREFIX}-action-vote-button`,
    inline: `${constants_1.PREFIX}-action-vote-inline`,
    viewAudienceButton: `${constants_1.PREFIX}-action-vote-view-audience-button`
};
const Root = (0, styles_1.styled)(material_1.Box, {
    name: constants_1.PREFIX,
    slot: 'ActionVoteRoot'
})(() => ({}));
function Vote(props) {
    // PROPS
    const { className = null, feedObjectId = null, feedObject = null, feedObjectType = null, withAudience = true, withAction = true, inlineAction = false, onVoteAction = () => null } = props, rest = tslib_1.__rest(props, ["className", "feedObjectId", "feedObject", "feedObjectType", "withAudience", "withAction", "inlineAction", "onVoteAction"]);
    // RENDER
    return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className, { [classes.inline]: inlineAction }) }, rest, { children: [withAudience && ((0, jsx_runtime_1.jsx)(VoteAudienceButton_1.default, { className: classes.viewAudienceButton, contributionId: feedObjectId, contributionType: feedObjectType, contribution: feedObject, variant: "text", size: "small" })), withAction && ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [!inlineAction && withAudience && (0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.divider }), (0, jsx_runtime_1.jsx)(VoteButton_1.default, { className: classes.button, contributionId: feedObjectId, contributionType: feedObjectType, contribution: feedObject, onVote: onVoteAction })] }))] })));
}
exports.default = Vote;
