contract PassCommitteeRoomInterface {

    // The Pass Dao smart contract
    PassDao public passDao;

    enum ProposalTypes { contractor, resolution, rules, upgrade }

    struct Committee {        
        // Address of the creator of the committee
        address creator;  
        // The type of the proposal
        ProposalTypes proposalType;
        // Index to identify the proposal
        uint proposalID;
        // unix timestamp, denoting the end of the set period of a proposal before the committee 
        uint setDeadline;
        // Fees (in wei) paid by the creator of the proposal
        uint fees;
        // Total of fees (in wei) rewarded to the voters
        uint totalRewardedAmount;
        // A unix timestamp, denoting the end of the voting period
        uint votingDeadline;
        // True if the proposal's votes have yet to be counted, otherwise False
        bool open; 
        // A unix timestamp, denoting the date of the execution of the approved proposal
        uint dateOfExecution;
        // Number of shares in favor of the proposal
        uint yea; 
        // Number of shares opposed to the proposal
        uint nay; 
    }
    // Committees organized to vote for or against a proposal
    Committee[] public Committees; 
    // mapping to indicate if a shareholder has voted at a committee or not
    mapping (uint => mapping (address => bool)) hasVoted;

    struct Proposal {
        // Index to identify the committee
        uint committeeID;
        // The contractor smart contract (not mandatory if funding)
        PassContractor contractor;
        // The index of the contractor proposal in the contractor contract (not mandatory if funding)
        uint contractorProposalID;
        // The amount of the proposal from the share manager balance (for funding or contractor proposals)
        uint amount;
        // The address which sets partners and manages the funding (not mandatory)
        address moderator;
        // Amount from the sale of shares (for funding or contractor proposals)
        uint amountForShares;
        // The initial price multiplier of Dao shares at the beginning of the funding (not mandatory)
        uint initialSharePriceMultiplier; 
        // Amount from the sale of tokens (for project manager proposals)
        uint amountForTokens;
        // A unix timestamp, denoting the start time of the funding
        uint minutesFundingPeriod;
        // True if the proposal is closed
        bool open; 
    }
    // Proposals to pay a contractor or/and fund the Dao
    Proposal[] public Proposals;

    struct Question {
        // Index to identify a committee
        uint committeeID; 
        // The project smart contract
        PassProject project;
        // The name of the question for display purpose
        string name;
        // A description of the question
        string description;
    }
    // Questions submitted to a vote by the shareholders 
    Question[] public ResolutionProposals;
    
    struct Rules {
        // Index to identify a committee
        uint committeeID; 
        // The quorum needed for each proposal is calculated by totalSupply / minQuorumDivisor
        uint minQuorumDivisor;  
        // Minimum fees (in wei) to create a proposal
        uint minCommitteeFees; 
        // Minimum percentage of votes for a proposal to reward the creator
        uint minPercentageOfLikes;
        // Period in minutes to consider or set a proposal before the voting procedure
        uint minutesSetProposalPeriod; 
        // The minimum debate period in minutes that a generic proposal can have
        uint minMinutesDebatePeriod;
        // The inflation rate to calculate the reward of fees to voters
        uint feesRewardInflationRate;
        // The inflation rate to calculate the token price (for project manager proposals) 
        uint tokenPriceInflationRate;
        // The default minutes funding period
        uint defaultMinutesFundingPeriod;
    } 
    // Proposals to update the committee rules
    Rules[] public rulesProposals;

    struct Upgrade {
        // Index to identify a committee
        uint committeeID; 
        // Address of the proposed Committee Room smart contract
        address newCommitteeRoom;
        // Address of the proposed share manager smart contract
        address newShareManager;
        // Address of the proposed token manager smart contract
        address newTokenManager;
    }
    // Proposals to upgrade
    Upgrade[] public UpgradeProposals;
    
    // The minimum periods in minutes 
    uint minMinutesPeriods;
    // The maximum inflation rate for token price or rewards to voters
    uint maxInflationRate;
    
    /// @return the effective share manager
    function ShareManager() constant returns (PassManager);

    /// @return the effective token manager
    function TokenManager() constant returns (PassManager);

    /// return the balance of the DAO
    function Balance() constant returns (uint);
    
    /// @param _committeeID The index of the committee
    /// @param _shareHolder The shareholder (not mandatory, default : msg.sender)
    /// @return true if the shareholder has voted at the committee
    function HasVoted(
        uint _committeeID, 
        address _shareHolder) constant external returns (bool);
    
    /// @return The minimum quorum for proposals to pass 
    function minQuorum() constant returns (uint);

    /// @return The number of committees 
    function numberOfCommittees() constant returns (uint);
    
    /// @dev The constructor function
    /// @param _passDao Address of Pass Dao
    //function PassCommitteeRoom(address _passDao);

    /// @notice Function to init an set the committee rules
    /// @param _maxInflationRate The maximum inflation rate for contractor and funding proposals
    /// @param _minMinutesPeriods The minimum periods in minutes
    /// @param _minQuorumDivisor The initial minimum quorum divisor for the proposals
    /// @param _minCommitteeFees The minimum amount (in wei) to make a proposal
    /// @param _minPercentageOfLikes Minimum percentage of votes for a proposal to reward the creator
    /// @param _minutesSetProposalPeriod The minimum period in minutes before a committee
    /// @param _minMinutesDebatePeriod The minimum period in minutes of the board meetings
    /// @param _feesRewardInflationRate The inflation rate to calculate the reward of fees to voters during a committee
    /// @param _tokenPriceInflationRate The inflation rate to calculate the token price for project manager proposals
    /// @param _defaultMinutesFundingPeriod Default period in minutes of the funding
    function init(
        uint _maxInflationRate,
        uint _minMinutesPeriods,
        uint _minQuorumDivisor,
        uint _minCommitteeFees,
        uint _minPercentageOfLikes,
        uint _minutesSetProposalPeriod,
        uint _minMinutesDebatePeriod,
        uint _feesRewardInflationRate,
        uint _tokenPriceInflationRate,
        uint _defaultMinutesFundingPeriod);

    /// @notice Function to create a contractor smart contract
    /// @param _contractorCreator The contractor creator smart contract
    /// @param _recipient The recipient of the contractor smart contract
    /// @param _metaProject True if meta project
    /// @param _passProject The project smart contract (not mandatory)
    /// @param _projectName The name of the project (if the project smart contract doesn't exist)
    /// @param _projectDescription A description of the project (not mandatory, can be updated after)
    /// @return The contractor smart contract
    function createContractor(
        PassContractorCreator _contractorCreator,
        address _recipient,
        bool _metaProject,
        PassProject _passProject,
        string _projectName, 
        string _projectDescription) returns (PassContractor);
    
    /// @notice Function to make a proposal to pay a contractor or/and fund the Dao
    /// @param _amount Amount of the proposal
    /// @param _contractor The contractor smart contract
    /// @param _contractorProposalID Index of the contractor proposal in the contractor smart contract (not mandatory)
    /// @param _proposalDescription String describing the proposal (if not existing proposal)
    /// @param _hashOfTheContractorProposalDocument The hash of the Contractor proposal document (if not existing proposal)
    /// @param _moderator The address which sets partners and manage the funding (not mandatory)
    /// @param _initialSharePriceMultiplier The initial price multiplier of shares (for funding or contractor proposals)
    /// @param _minutesFundingPeriod Period in minutes of the funding (not mandatory)
    /// @param _minutesDebatingPeriod Period in minutes of the board meeting to vote on the proposal (not mandatory)
    /// @return The index of the proposal
    function contractorProposal(
        uint _amount,
        PassContractor _contractor,
        uint _contractorProposalID,
        string _proposalDescription, 
        bytes32 _hashOfTheContractorProposalDocument,
        address _moderator,
        uint _initialSharePriceMultiplier, 
        uint _minutesFundingPeriod,
        uint _minutesDebatingPeriod) payable returns (uint);

    /// @notice Function to submit a question
    /// @param _name Name of the question for display purpose
    /// @param _description A description of the question
    /// @param _project The project smart contract
    /// @param _minutesDebatingPeriod Period in minutes of the board meeting to vote on the proposal
    /// @return The index of the proposal
    function resolutionProposal(
        string _name,
        string _description,
        PassProject _project,
        uint _minutesDebatingPeriod) payable returns (uint);
        
    /// @notice Function to make a proposal to change the rules of the committee room 
    /// @param _minQuorumDivisor If 5, the minimum quorum is 20%
    /// @param _minCommitteeFees The minimum amount (in wei) to make a proposal
    /// @param _minPercentageOfLikes Minimum percentage of votes for a proposal to reward the creator
    /// @param _minutesSetProposalPeriod Minimum period in minutes before a committee
    /// @param _minMinutesDebatePeriod The minimum period in minutes of the committees
    /// @param _feesRewardInflationRate The inflation rate to calculate the reward of fees to voters during a committee
    /// @param _defaultMinutesFundingPeriod Period in minutes of the funding
    /// @param _tokenPriceInflationRate The inflation rate to calculate the token price for project manager proposals
    /// @return The index of the proposal
    function rulesProposal(
        uint _minQuorumDivisor, 
        uint _minCommitteeFees,
        uint _minPercentageOfLikes,
        uint _minutesSetProposalPeriod,
        uint _minMinutesDebatePeriod,
        uint _feesRewardInflationRate,
        uint _defaultMinutesFundingPeriod,
        uint _tokenPriceInflationRate) payable returns (uint);
    
    /// @notice Function to make a proposal to upgrade the application
    /// @param _newCommitteeRoom Address of a new Committee Room smart contract (not mandatory)   
    /// @param _newShareManager Address of a new share manager smart contract (not mandatory)
    /// @param _newTokenManager Address of a new token manager smart contract (not mandatory)
    /// @param _minutesDebatingPeriod Period in minutes of the committee to vote on the proposal (not mandatory)
    /// @return The index of the proposal
    function upgradeProposal(
        address _newCommitteeRoom,
        address _newShareManager,
        address _newTokenManager,
        uint _minutesDebatingPeriod) payable returns (uint);

    /// @dev Internal function to create a committee
    /// @param _proposalType The type of the proposal
    /// @param _proposalID The index of the proposal
    /// @param _minutesDebatingPeriod The duration in minutes of the committee
    /// @return the index of the board meeting
    function newCommittee(
        ProposalTypes _proposalType,
        uint _proposalID, 
        uint _minutesDebatingPeriod) internal returns (uint);
        
    /// @notice Function to vote for or against a proposal during a committee
    /// @param _committeeID The index of the committee
    /// @param _supportsProposal True if the proposal is supported
    function vote(
        uint _committeeID, 
        bool _supportsProposal);
    
    /// @notice Function to execute a decision and close the committee
    /// @param _committeeID The index of the committee
    /// @return Whether the proposal was executed or not
    function executeDecision(uint _committeeID) returns (bool);
    
    /// @notice Function to order to a contractor and close a contractor proposal
    /// @param _proposalID The index of the proposal
    /// @return Whether the proposal was ordered and the proposal amount sent or not
    function orderToContractor(uint _proposalID) returns (bool);   

    /// @notice Function to buy shares and or/and promote a contractor proposal 
    /// @param _proposalID The index of the proposal
    /// @return Whether the function was successful or not
    function buySharesForProposal(uint _proposalID) payable returns (bool);
    
    /// @notice Function to send tokens or refund after the closing time of the funding proposals
    /// @param _from The first proposal. 0 if not linked to a proposal
    /// @param _to The last proposal
    /// @param _buyer The address of the buyer
    /// @return Whether the function was successful or not 
    function sendPendingAmounts(        
        uint _from,
        uint _to,
        address _buyer) returns (bool);
        
    /// @notice Function to receive tokens or refund after the closing time of the funding proposals
    /// @return Whether the function was successful or not
    function withdrawPendingAmounts() returns (bool);

    event CommitteeLimits(uint maxInflationRate, uint minMinutesPeriods);
    
    event ContractorCreated(PassContractorCreator Creator, address indexed Sender, PassContractor Contractor, address Recipient);

    event ProposalSubmitted(uint indexed ProposalID, uint CommitteeID, PassContractor indexed Contractor, uint indexed ContractorProposalID, 
        uint Amount, string Description, address Moderator, uint SharePriceMultiplier, uint MinutesFundingPeriod);
    event ResolutionProposalSubmitted(uint indexed QuestionID, uint indexed CommitteeID, PassProject indexed Project, string Name, string Description);
    event RulesProposalSubmitted(uint indexed rulesProposalID, uint CommitteeID, uint MinQuorumDivisor, uint MinCommitteeFees, uint MinPercentageOfLikes, 
        uint MinutesSetProposalPeriod, uint MinMinutesDebatePeriod, uint FeesRewardInflationRate, uint DefaultMinutesFundingPeriod, uint TokenPriceInflationRate);
    event UpgradeProposalSubmitted(uint indexed UpgradeProposalID, uint indexed CommitteeID, address NewCommitteeRoom, 
        address NewShareManager, address NewTokenManager);

    event Voted(uint indexed CommitteeID, bool Position, address indexed Voter, uint RewardedAmount);

    event ProposalClosed(uint indexed ProposalID, ProposalTypes indexed ProposalType, uint CommitteeID, 
        uint TotalRewardedAmount, bool ProposalExecuted, uint RewardedSharesAmount, uint SentToManager);
    event ContractorProposalClosed(uint indexed ProposalID, uint indexed ContractorProposalID, PassContractor indexed Contractor, uint AmountSent);
    event DappUpgraded(address NewCommitteeRoom, address NewShareManager, address NewTokenManager);

}
/// @title Pass Committee Room
function newCommittee(
    ProposalTypes _proposalType,
    uint _proposalID, 
    uint _minutesDebatingPeriod) internal returns (uint);

/// @dev Internal function to create a committee
/// @param _proposalType The type of the proposal
/// @param _proposalID The index of the proposal
/// @param _minutesDebatingPeriod The duration in minutes of the committee
/// @return the index of the board meeting