contract KWWVoteManager is Ownable{
    IVoting votingContract;
    IVotingBoatNFT boatsNFTContract;
    //KWWDataBoats boatsDataContract;
    IVotingBoatData boatsDataContract;

    constructor(address _voting, address _nft, address _data){
        setVoting(_voting);
        setBoatsNFT(_nft);
        setBoatsData(_data);
    }


    /*
        EXECUTION METHODS
    */

    function makeVote1(uint16 token, uint256 votePrice) public {
        require(boatsNFTContract.ownerOf(token) == msg.sender, "Caller is not the owner of the token");
        uint8 boatState = boatsDataContract.getBoatState(token);
        votingContract.makeVote1(token, votePrice, boatState);
    }

    function makeVote2(uint16 token, bool voteDecision) public {
        require(boatsNFTContract.ownerOf(token) == msg.sender, "Caller is not the owner of the token");
        uint8 boatState = boatsDataContract.getBoatState(token);
        votingContract.makeVote2(token, voteDecision, boatState);
    }

    function updatePrice(uint16 token) public {
        uint8 boatState = boatsDataContract.getBoatState(token);
        votingContract.updatePrice(boatState);
    }

    function updateStatePrice(uint8 boatState) public {
        votingContract.updatePrice(boatState);
    }


    /*
        GETTERS
    */
    function getOnlineVote() public view returns(uint8){
        return votingContract.getCurrentOnlineVote();
    }

    function getOnlineVoteEndTime() public view returns(int){
        return votingContract.getCurrentVoteEndTime();
    }

    function getBoatPrice(uint16 token) public view returns(uint256){
        uint8 boatState = boatsDataContract.getBoatState(token);
        return votingContract.getPrice(boatState);
    }

    function getStateVoteDetails(uint16 token) public view returns(IBoatsVoting.TypeVote memory){
        uint8 boatState = boatsDataContract.getBoatState(token);
        return votingContract.getVoteDetails(boatState);
    }

    function getBoatDetails(uint16 token) public view returns(IBoatsVoting.BoatData memory){
        return votingContract.getBoatDetails(token);
    }



    /*
        ONLY OWNER
    */

    function setVoting(address _voting) public onlyOwner{
        votingContract = IVoting(_voting);
    }
        
    function setBoatsNFT(address _nft) public onlyOwner{
        boatsNFTContract = IVotingBoatNFT(_nft);
    }
        
    function setBoatsData(address _data) public onlyOwner{
        boatsDataContract = IVotingBoatData(_data);
    }
}
//import "./KWWBoatsVoting.sol";
//import "./KWWBoats.sol";
//import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
function makeVote1(uint16 token, uint256 votePrice) public {
    require(boatsNFTContract.ownerOf(token) == msg.sender, "Caller is not the owner of the token");
    uint8 boatState = boatsDataContract.getBoatState(token);
    votingContract.makeVote1(token, votePrice, boatState);
}

/*
 EXECUTION METHODS
 */