<?php

namespace Kylin\Payment\Scenarios;

use Kylin\Payment\Payment;

/**
 * 娱乐支付场景类
 */
class EntertainmentPayment
{
    /**
     * 构造函数
     */
    public function __construct(
        protected readonly string $paymentType,
        protected readonly string $name = 'default'
    ) {}

    /**
     * 创建娱乐支付订单
     */
    public function create(array $params): mixed
    {
        // 确保参数中包含娱乐支付相关信息
        $params['entertainment'] = $params['entertainment'] ?? [];

        // 调用支付方法
        return Payment::pay($this->paymentType, $params, $this->name);
    }

    /**
     * 支付娱乐订单
     */
    public function pay(string $orderId, array $params): mixed
    {
        return Payment::pay($this->paymentType, array_merge($params, ['order_id' => $orderId]), $this->name);
    }

    /**
     * 取消娱乐订单
     */
    public function cancel(string $orderId): mixed
    {
        return Payment::close($this->paymentType, $orderId, $this->name);
    }

    /**
     * 查询娱乐订单状态
     */
    public function status(string $orderId): mixed
    {
        return Payment::query($this->paymentType, $orderId, $this->name);
    }

    /**
     * 娱乐退款
     */
    public function refund(string $orderId, array $params): mixed
    {
        return Payment::refund($this->paymentType, array_merge($params, ['order_id' => $orderId]), $this->name);
    }

    /**
     * 电影票购买
     */
    public function movieTicket(array $params): mixed
    {
        // 确保参数中包含电影票购买相关信息
        $params['movie'] = $params['movie'] ?? [];

        // 调用支付方法
        return Payment::pay($this->paymentType, $params, $this->name);
    }

    /**
     * 演唱会门票购买
     */
    public function concertTicket(array $params): mixed
    {
        // 确保参数中包含演唱会门票购买相关信息
        $params['concert'] = $params['concert'] ?? [];

        // 调用支付方法
        return Payment::pay($this->paymentType, $params, $this->name);
    }

    /**
     * 游戏充值
     */
    public function gameRecharge(array $params): mixed
    {
        // 确保参数中包含游戏充值相关信息
        $params['game'] = $params['game'] ?? [];

        // 调用支付方法
        return Payment::pay($this->paymentType, $params, $this->name);
    }

    /**
     * 游乐园门票购买
     */
    public function amusementParkTicket(array $params): mixed
    {
        // 确保参数中包含游乐园门票购买相关信息
        $params['amusement_park'] = $params['amusement_park'] ?? [];

        // 调用支付方法
        return Payment::pay($this->paymentType, $params, $this->name);
    }

    /**
     * 体育赛事门票购买
     */
    public function sportsEventTicket(array $params): mixed
    {
        // 确保参数中包含体育赛事门票购买相关信息
        $params['sports_event'] = $params['sports_event'] ?? [];

        // 调用支付方法
        return Payment::pay($this->paymentType, $params, $this->name);
    }

    /**
     * 获取娱乐订单记录
     */
    public function getEntertainmentRecords(string $userId): mixed
    {
        return Payment::query($this->paymentType, $userId, $this->name);
    }

    /**
     * 娱乐会员订阅
     */
    public function entertainmentMembership(array $params): mixed
    {
        // 确保参数中包含娱乐会员订阅相关信息
        $params['membership'] = $params['membership'] ?? [];

        // 调用支付方法
        return Payment::pay($this->paymentType, $params, $this->name);
    }
}
