<?php
declare(strict_types=1);

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

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

use Automattic\WooCommerce\Internal\Api\Autogenerated\GraphQLTypes\Enums\DiscountType as DiscountTypeType;
use Automattic\WooCommerce\Internal\Api\Autogenerated\GraphQLTypes\Enums\CouponStatus as CouponStatusType;
use Automattic\WooCommerce\Internal\Api\Autogenerated\GraphQLTypes\Scalars\DateTime as DateTimeType;
use Automattic\WooCommerce\Internal\Api\Autogenerated\GraphQLTypes\Interfaces\ObjectWithId as ObjectWithIdInterface;
use Automattic\WooCommerce\Api\Infrastructure\Schema\ObjectType;
use Automattic\WooCommerce\Api\Infrastructure\Schema\Type;

class Coupon {
	private static ?ObjectType $instance = null;

	public static function get(): ObjectType {
		if ( null === self::$instance ) {
			self::$instance = new ObjectType(
				array(
					'name'        => 'Coupon',
					'description' => __( 'Represents a WooCommerce discount coupon.', 'woocommerce' ),
					'interfaces'  => fn() => array(
						ObjectWithIdInterface::get(),
					),
					'fields'      => fn() => array(
						'code'                        => array(
							'type'        => Type::nonNull( Type::string() ),
							'description' => __( 'The coupon code.', 'woocommerce' ),
						),
						'description'                 => array(
							'type'        => Type::nonNull( Type::string() ),
							'description' => __( 'The coupon description.', 'woocommerce' ),
						),
						'discount_type'               => array(
							'type'        => Type::nonNull( DiscountTypeType::get() ),
							'description' => __( 'The type of discount.', 'woocommerce' ),
						),
						'raw_discount_type'           => array(
							'type'        => Type::nonNull( Type::string() ),
							'description' => __( 'The raw discount type as stored in WooCommerce. Useful when discount_type is OTHER (e.g. plugin-added types like recurring_percent or sign_up_fee).', 'woocommerce' ),
						),
						'amount'                      => array(
							'type'        => Type::nonNull( Type::float() ),
							'description' => __( 'The discount amount.', 'woocommerce' ),
						),
						'status'                      => array(
							'type'        => Type::nonNull( CouponStatusType::get() ),
							'description' => __( 'The coupon status.', 'woocommerce' ),
						),
						'raw_status'                  => array(
							'type'        => Type::nonNull( Type::string() ),
							'description' => __( 'The raw status as stored in WordPress. Useful when status is OTHER (e.g. plugin-added post statuses).', 'woocommerce' ),
						),
						'date_created'                => array(
							'type'        => DateTimeType::get(),
							'description' => __( 'The date the coupon was created.', 'woocommerce' ),
						),
						'date_modified'               => array(
							'type'        => DateTimeType::get(),
							'description' => __( 'The date the coupon was last modified.', 'woocommerce' ),
						),
						'date_expires'                => array(
							'type'        => DateTimeType::get(),
							'description' => __( 'The date the coupon expires.', 'woocommerce' ),
						),
						'usage_count'                 => array(
							'type'        => Type::nonNull( Type::int() ),
							'description' => __( 'The number of times the coupon has been used.', 'woocommerce' ),
						),
						'individual_use'              => array(
							'type'        => Type::nonNull( Type::boolean() ),
							'description' => __( 'Whether the coupon can only be used alone.', 'woocommerce' ),
						),
						'product_ids'                 => array(
							'type'        => Type::nonNull( Type::listOf( Type::nonNull( Type::int() ) ) ),
							'description' => __( 'Product IDs the coupon can be applied to.', 'woocommerce' ),
						),
						'excluded_product_ids'        => array(
							'type'        => Type::nonNull( Type::listOf( Type::nonNull( Type::int() ) ) ),
							'description' => __( 'Product IDs excluded from the coupon.', 'woocommerce' ),
						),
						'usage_limit'                 => array(
							'type'        => Type::nonNull( Type::int() ),
							'description' => __( 'Maximum number of times the coupon can be used in total.', 'woocommerce' ),
						),
						'usage_limit_per_user'        => array(
							'type'        => Type::nonNull( Type::int() ),
							'description' => __( 'Maximum number of times the coupon can be used per customer.', 'woocommerce' ),
						),
						'limit_usage_to_x_items'      => array(
							'type'        => Type::int(),
							'description' => __( 'Maximum number of items the coupon can be applied to.', 'woocommerce' ),
						),
						'free_shipping'               => array(
							'type'        => Type::nonNull( Type::boolean() ),
							'description' => __( 'Whether the coupon grants free shipping.', 'woocommerce' ),
						),
						'product_categories'          => array(
							'type'        => Type::nonNull( Type::listOf( Type::nonNull( Type::int() ) ) ),
							'description' => __( 'Product category IDs the coupon applies to.', 'woocommerce' ),
						),
						'excluded_product_categories' => array(
							'type'        => Type::nonNull( Type::listOf( Type::nonNull( Type::int() ) ) ),
							'description' => __( 'Product category IDs excluded from the coupon.', 'woocommerce' ),
						),
						'exclude_sale_items'          => array(
							'type'        => Type::nonNull( Type::boolean() ),
							'description' => __( 'Whether the coupon excludes items on sale.', 'woocommerce' ),
						),
						'minimum_amount'              => array(
							'type'        => Type::nonNull( Type::float() ),
							'description' => __( 'Minimum order amount required to use the coupon.', 'woocommerce' ),
						),
						'maximum_amount'              => array(
							'type'        => Type::nonNull( Type::float() ),
							'description' => __( 'Maximum order amount allowed to use the coupon.', 'woocommerce' ),
						),
						'email_restrictions'          => array(
							'type'        => Type::nonNull( Type::listOf( Type::nonNull( Type::string() ) ) ),
							'description' => __( 'Email addresses that can use this coupon.', 'woocommerce' ),
						),
						'used_by'                     => array(
							'type'        => Type::nonNull( Type::listOf( Type::nonNull( Type::string() ) ) ),
							'description' => __( 'Email addresses of customers who have used this coupon.', 'woocommerce' ),
						),
						'id'                          => array(
							'type'        => Type::nonNull( Type::int() ),
							'description' => __( 'The unique numeric identifier.', 'woocommerce' ),
						),
					),
				)
			);
		}
		return self::$instance;
	}
}
