pragma solidity >=0.6.6 <0.9.0;

interface IMarket {
    enum OrderType {
        Public, // 0
        Private, // 1
        Event_Private //2
    }

    enum PaymentType {
        Normal // 0
    }

    struct Lending {
        address lender;
        address nftAddress;
        uint256 nftId;
        uint64 maxEndTime;
        uint64 minDuration;
        uint64 createTime;
        uint64 nonce;
        OrderType orderType;
        PaymentType paymentType;
    }

    struct PaymentNormal {
        address token;
        uint256 pricePerDay;
    }

    event CreateLendOrder(
        address lender,
        address nftAddress,
        uint256 nftId,
        uint64 maxEndTime,
        uint64 minDuration,
        uint256 pricePerDay,
        address paymentToken,
        address renter,
        OrderType orderType
    );
    event CancelLendOrder(address lender, address nftAddress, uint256 nftId);
    event FulfillOrder(
        address renter,
        address lender,
        address nftAddress,
        uint256 nftId,
        uint64 startTime,
        uint64 endTime,
        uint256 pricePerDay,
        uint256 newId,
        address paymentToken
    );
    event Paused(address account);
    event Unpaused(address account);

    function mintAndCreateLendOrder(
        address resolverAddress,
        uint256 oNftId,
        uint64 maxEndTime,
        uint64 minDuration,
        uint256 pricePerDay,
        address paymentToken
    ) external;

    function createLendOrder(
        address nftAddress,
        uint256 nftId,
        uint64 maxEndTime,
        uint64 minDuration,
        uint256 pricePerDay,
        address paymentToken
    ) external;

    function cancelLendOrder(address nftAddress, uint256 nftId) external;

    function getLendOrder(address nftAddress, uint256 nftId)
        external
        view
        returns (Lending memory);

    function getRenterOfPrivateLendOrder(address nftAddress, uint256 nftId)
        external
        view
        returns (address);

    function getPaymentNormal(address nftAddress, uint256 nftId)
        external
        view
        returns (PaymentNormal memory paymentNormal);

    function fulfillOrderNow(
        address nftAddress,
        uint256 nftId,
        uint256 durationId,
        uint64 duration,
        address user,
        address paymentToken,
        uint256 pricePerDay
    ) external payable returns (uint256 tid);

    function setFee(uint256 fee) external;

    function getFee() external view returns (uint256);

    function setMarketBeneficiary(address payable beneficiary) external;

    function claimFee(address[] calldata paymentTokens) external;

    function claimRoyalty(address nftAddress, address[] calldata paymentTokens)
        external;

    function isLendOrderValid(address nftAddress, uint256 nftId)
        external
        view
        returns (bool);

    function setPause(bool v) external;
}
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"CancelLendOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"maxEndTime","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"minDuration","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"pricePerDay","type":"uint256"},{"indexed":false,"internalType":"address","name":"paymentToken","type":"address"},{"indexed":false,"internalType":"address","name":"renter","type":"address"},{"indexed":false,"internalType":"enum IMarket.OrderType","name":"orderType","type":"uint8"}],"name":"CreateLendOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"renter","type":"address"},{"indexed":false,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"startTime","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"endTime","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"pricePerDay","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newId","type":"uint256"},{"indexed":false,"internalType":"address","name":"paymentToken","type":"address"}],"name":"FulfillOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"NewAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"NewOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPendingOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newPendingOwner","type":"address"}],"name":"NewPendingOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"acceptOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOfFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"address","name":"paymentToken","type":"address"}],"name":"balanceOfRoyalty","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beneficiary","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"cancelLendOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"paymentTokens","type":"address[]"}],"name":"claimFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"address[]","name":"paymentTokens","type":"address[]"}],"name":"claimRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint64","name":"maxEndTime","type":"uint64"},{"internalType":"uint64","name":"minDuration","type":"uint64"},{"internalType":"uint256","name":"pricePerDay","type":"uint256"},{"internalType":"address","name":"paymentToken","type":"address"}],"name":"createLendOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint64","name":"maxEndTime","type":"uint64"},{"internalType":"uint64","name":"minDuration","type":"uint64"},{"internalType":"uint256","name":"pricePerDay","type":"uint256"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"address","name":"renter","type":"address"},{"internalType":"enum IMarket.OrderType","name":"orderType","type":"uint8"}],"name":"createPrivateLendOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint256","name":"durationId","type":"uint256"},{"internalType":"uint64","name":"duration","type":"uint64"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"pricePerDay","type":"uint256"}],"name":"fulfillOrderNow","outputs":[{"internalType":"uint256","name":"tid","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"getLendOrder","outputs":[{"components":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint64","name":"maxEndTime","type":"uint64"},{"internalType":"uint64","name":"minDuration","type":"uint64"},{"internalType":"uint64","name":"createTime","type":"uint64"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"enum IMarket.OrderType","name":"orderType","type":"uint8"},{"internalType":"enum IMarket.PaymentType","name":"paymentType","type":"uint8"}],"internalType":"struct IMarket.Lending","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"getPaymentNormal","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"pricePerDay","type":"uint256"}],"internalType":"struct IMarket.PaymentNormal","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"getRenterOfPrivateLendOrder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"address","name":"admin_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"isLendOrderValid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPausing","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxIndate","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"doNftAddress","type":"address"},{"internalType":"uint256","name":"oNftId","type":"uint256"},{"internalType":"uint64","name":"maxEndTime","type":"uint64"},{"internalType":"uint64","name":"minDuration","type":"uint64"},{"internalType":"uint256","name":"pricePerDay","type":"uint256"},{"internalType":"address","name":"paymentToken","type":"address"}],"name":"mintAndCreateLendOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"doNftAddress","type":"address"},{"internalType":"uint256","name":"oNftId","type":"uint256"},{"internalType":"uint64","name":"maxEndTime","type":"uint64"},{"internalType":"uint64","name":"minDuration","type":"uint64"},{"internalType":"uint256","name":"pricePerDay","type":"uint256"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"address","name":"renter","type":"address"},{"internalType":"enum IMarket.OrderType","name":"orderType","type":"uint8"}],"name":"mintAndCreatePrivateLendOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fee_","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"beneficiary_","type":"address"}],"name":"setMarketBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"max_","type":"uint64"}],"name":"setMaxIndate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"pause_","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supportERC20","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pendingOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]