<?php
declare(strict_types=1);

// THIS FILE IS AUTO-GENERATED. DO NOT EDIT MANUALLY.

namespace Automattic\WooCommerce\Internal\Api\Autogenerated\GraphQLTypes\Interfaces;

use Automattic\WooCommerce\Internal\Api\Autogenerated\GraphQLTypes\Output\Coupon as CouponType;
use Automattic\WooCommerce\Internal\Api\Schema\InterfaceType;
use Automattic\WooCommerce\Internal\Api\Schema\Type;

class ObjectWithId {
	private static ?InterfaceType $instance = null;

	public static function get(): InterfaceType {
		if ( null === self::$instance ) {
			self::$instance = new InterfaceType(
				array(
					'name'        => 'ObjectWithId',
					'description' => __( 'An object with a numeric ID.', 'woocommerce' ),
					'fields'      => fn() => array(
						'id' => array(
							'type'        => Type::nonNull( Type::int() ),
							'description' => __( 'The unique numeric identifier.', 'woocommerce' ),
						),
					),
					'resolveType' => function ( $value ) {
						$class = get_class( $value );
						$map = array(
							'Automattic\WooCommerce\Api\Types\Coupons\Coupon' => CouponType::get(),
						);
						return $map[ $class ] ?? null;
					},
				)
			);
		}
		return self::$instance;
	}
}
