// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

contract YTLPToken is Initializable, ERC20Upgradeable, OwnableUpgradeable, UUPSUpgradeable {

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    error NotMinter();
    error InvalidMinter();
    
    mapping(address => bool) public isMinter;
    
    event MinterSet(address indexed minter, bool isActive);
    
    function initialize() external initializer {
        __ERC20_init("YT Liquidity Provider", "ytLP");
        __Ownable_init(msg.sender);
        __UUPSUpgradeable_init();
    }
    
    function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
    
    modifier onlyMinter() {
        if (!isMinter[msg.sender]) revert NotMinter();
        _;
    }
    
    function setMinter(address _minter, bool _isActive) external onlyOwner {
        if (_minter == address(0)) revert InvalidMinter();
        isMinter[_minter] = _isActive;
        emit MinterSet(_minter, _isActive);
    }
    
    function mint(address _to, uint256 _amount) external onlyMinter {
        _mint(_to, _amount);
    }
    
    function burn(address _from, uint256 _amount) external onlyMinter {
        _burn(_from, _amount);
    }
    
    uint256[50] private __gap;
}