contract Sales is Discount {

    constructor(address _address) public {
        ParentInterface candidateContract = ParentInterface(_address);
        parent = candidateContract;
        paused = true;
    }
    
	// purchasing a parrot
    function purchaseParrot(uint256 _tokenId) external payable whenNotPaused
    {
        uint64 birthTime; uint256 genes; uint64 breedTimeout; uint16 quality; address parrot_owner;
        (birthTime,  genes, breedTimeout, quality, parrot_owner) = parent.getPet(_tokenId);
        
        require(parrot_owner == address(this));
        
        if(discount[_tokenId] == 0)
            require(parent.recommendedPrice(quality) <= msg.value);
        else
            require(discount[_tokenId] <= msg.value);
        
        parent.transfer(msg.sender, _tokenId);
    }
    
    function gift(uint256 _tokenId, address to) external onlyOwner{
        parent.transfer(to, _tokenId);
    }

    function withdrawBalance(uint256 summ) external onlyCFO {
        cfoAddress.transfer(summ);
    }
}
function purchaseParrot(uint256 _tokenId) external payable whenNotPaused
{
    uint64 birthTime; uint256 genes; uint64 breedTimeout; uint16 quality; address parrot_owner;
    (birthTime,  genes, breedTimeout, quality, parrot_owner) = parent.getPet(_tokenId);
        
    require(parrot_owner == address(this));
        
    if(discount[_tokenId] == 0)
        require(parent.recommendedPrice(quality) <= msg.value);
    else
        require(discount[_tokenId] <= msg.value);
        
    parent.transfer(msg.sender, _tokenId);
}

// purchasing a parrot