<?php

namespace Dev4Press\Plugin\coreSocial\Networks;

use Dev4Press\Plugin\coreSocial\Base\Network;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class CopyURL extends Network {
	protected string $network = 'copyurl';
	protected string $action = 'show';

	public static function instance() : CopyURL {
		static $instance = null;

		if ( ! isset( $instance ) ) {
			$instance = new CopyURL();
		}

		return $instance;
	}

	public function prepare( string $url, string $title, string $image_url = '', string $item = 'post', int $item_id = 0 ) : array {
		$args = parent::prepare( $url, $title, $image_url, $item, $item_id );

		$args['data']['clipboard-text'] = $url;

		return $args;
	}

	protected function get_default_icon_name() : string {
		return 'clipboard';
	}

	public function loaded() {
		wp_enqueue_script( 'clipboard' );
	}

	public function get_share_link( string $url, string $title, string $image_url = '', string $item = 'post', int $item_id = 0 ) : string {
		return '';
	}
}
