contract NotesharesToken is NSERC667 {
    using SafeMath for uint256;

    uint8 public state; //0 - canceled, 1 - active, 2 - failed, 3 - complete

    string private contentLink;
    string private folderLink;
    bool public hidden = false;

    constructor (string _contentLink, string _folderLink, address _ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
    public
    NSERC667(_ecosystemFeeAccount, ecosystemShare, _custom_owner) {
        state = 3;
        contentLink = _contentLink;
        folderLink = _folderLink;
    }

    //payables
    /**
     * Main donation function
     */
    function () public payable {
        require(state == 3); //donations only acceptable if contract is complete
        receivePayment();
    }

    function getContentLink () public view returns (string) {
        require(hidden == false);
        return contentLink;
    }

    function getFolderLink() public view returns (string) {
        require(hidden == false);
        return folderLink;
    }
    //Contract control
    /**
     * Transfers dividend in ETH if contract is complete or remaining funds to investors if contract is failed
     */

    function setCancelled () public onlyOwner {
        state = 0;
    }

    function setHidden (bool _hidden) public onlyOwner {
        hidden = _hidden;
    }

    function claimDividend () public {
        require(state > 1);
        collectOwedDividends();
    }

    //destruction is possible if there is only one owner
    function destruct () public onlyOwner {
        require(state == 2 || state == 3);
        require(balanceOf[owner()] == totalSupply);
        selfdestruct(owner());
    }

    //to claim ownership you should have 100% of tokens
    function claimOwnership () public {
        //require(state == 2);
        require(balanceOf[msg.sender] == totalSupply);
        _transferOwnership(msg.sender);
    }
}
function destruct () public onlyOwner {
    require(state == 2 || state == 3);
    require(balanceOf[owner()] == totalSupply);
    selfdestruct(owner());
}

//destruction is possible if there is only one owner