import { __rest } from "tslib";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React from 'react';
import { Box, Divider } from '@mui/material';
import { styled } from '@mui/material/styles';
import classNames from 'classnames';
import VoteButton from '../../../VoteButton';
import VoteAudienceButton from '../../../VoteAudienceButton';
import { PREFIX } from '../../constants';
const classes = {
    root: `${PREFIX}-action-vote-root`,
    divider: `${PREFIX}-action-vote-divider`,
    button: `${PREFIX}-action-vote-button`,
    inline: `${PREFIX}-action-vote-inline`,
    viewAudienceButton: `${PREFIX}-action-vote-view-audience-button`
};
const Root = styled(Box, {
    name: PREFIX,
    slot: 'ActionVoteRoot'
})(() => ({}));
export default function Vote(props) {
    // PROPS
    const { className = null, feedObjectId = null, feedObject = null, feedObjectType = null, withAudience = true, withAction = true, inlineAction = false, onVoteAction = () => null } = props, rest = __rest(props, ["className", "feedObjectId", "feedObject", "feedObjectType", "withAudience", "withAction", "inlineAction", "onVoteAction"]);
    // RENDER
    return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className, { [classes.inline]: inlineAction }) }, rest, { children: [withAudience && (_jsx(VoteAudienceButton, { className: classes.viewAudienceButton, contributionId: feedObjectId, contributionType: feedObjectType, contribution: feedObject, variant: "text", size: "small" })), withAction && (_jsxs(React.Fragment, { children: [!inlineAction && withAudience && _jsx(Divider, { className: classes.divider }), _jsx(VoteButton, { className: classes.button, contributionId: feedObjectId, contributionType: feedObjectType, contribution: feedObject, onVote: onVoteAction })] }))] })));
}
