pragma solidity 0.5.12;


contract Ownable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    
    constructor () internal {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), _owner);
    }

    
    function owner() public view returns (address) {
        return _owner;
    }

    
    modifier onlyOwner() {
        require(isOwner(), "Ownable: caller is not the owner");
        _;
    }

    
    function isOwner() public view returns (bool) {
        return msg.sender == _owner;
    }

    
    function renounceOwnership() public onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    
    function transferOwnership(address newOwner) public onlyOwner {
        _transferOwnership(newOwner);
    }

    
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

contract Certificate is Ownable  {
    bytes32 private _certificateHolderNameHash;
    string private _eventName;
    string private _organizer;
    string private _issuedBy;
    string private _issuedOn;

    constructor(
        string memory eventName,
        string memory organizer,
        string memory issuedBy,
        string memory issuedOn
    )
        public
    {
        _eventName = eventName;
        _organizer = organizer;
        _issuedBy = issuedBy;
        _issuedOn = issuedOn;
    }
    
    function setCertificateHolderNameHash(
        bytes32 certificateHolderNameHash
    )
        external
        onlyOwner
    {
        _certificateHolderNameHash = certificateHolderNameHash;
    }
    
    function name()
        external pure
        returns (string memory)
    {
        return "Lykke Academy Certificate";
    }
    
    function certificateType()
        external pure
        returns (string memory)
    {
        return "CERTIFICATE OF PARTICIPATION";
    }

    function certificateHolderNameHash()
        external view
        returns (bytes32)
    {
        return _certificateHolderNameHash;
    }
    
    function eventName()
        external view
        returns (string memory)
    {
        return _eventName;
    }
    
    function organizer()
        external view
        returns (string memory)
    {
        return _organizer;
    }
    
    function issuedBy()
        external view
        returns (string memory)
    {
        return _issuedBy;
    }

    function issuedOn()
        external view
        returns (string memory)
    {
        return _issuedOn;
    }

    function validateCertificateHolderName(
        string calldata certificateHolderName
    )
        external view
        returns (bool)
    {
        return _certificateHolderNameHash == keccak256(abi.encode(certificateHolderName));
    }
    
}