/**
 * Shell Card Management APIsLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

import { lazy, nullable, object, optional, Schema, string } from '../schema.js';
import {
  DayTimeRestrictions,
  dayTimeRestrictionsSchema,
} from './dayTimeRestrictions.js';
import {
  LocationRestriction,
  locationRestrictionSchema,
} from './locationRestriction.js';
import {
  ProductRestrictionCard,
  productRestrictionCardSchema,
} from './productRestrictionCard.js';
import {
  UsageRestrictionsCard,
  usageRestrictionsCardSchema,
} from './usageRestrictionsCard.js';

export interface BundleRestriction {
  /**
   * The value indicates what actions to be performed with respect to day time restriction.
   * Mandatory
   * Allowed values –
   * •    Add: Apply the given restriction on the bundle.
   * •    Default: No Day/Time restriction will be applied on the bundle in Gateway.
   */
  dayTimeRestrictionAction?: string | null;
  /**
   * The value indicates what actions to be performed with respect to location restriction.
   * Mandatory
   * Allowed values –
   * •    Add: Apply the given restriction on the bundle.
   * •    Default: No location restriction will be applied on the bundle in Gateway.
   */
  locationRestrictionAction?: string | null;
  /**
   * The value indicates what actions to be performed with respect to Product restriction.
   * Mandatory
   * Allowed values –
   * •    Add: Apply the given restriction on the bundle.
   * •    Default: No Product restriction will be applied on the bundle in Gateway.
   */
  productRestrictionAction?: string | null;
  dayTimeRestrictions?: DayTimeRestrictions;
  productRestrictions?: ProductRestrictionCard;
  locationRestrictions?: LocationRestriction;
  usageRestrictions?: UsageRestrictionsCard;
}

export const bundleRestrictionSchema: Schema<BundleRestriction> = lazy(() =>
  object({
    dayTimeRestrictionAction: [
      'DayTimeRestrictionAction',
      optional(nullable(string())),
    ],
    locationRestrictionAction: [
      'LocationRestrictionAction',
      optional(nullable(string())),
    ],
    productRestrictionAction: [
      'ProductRestrictionAction',
      optional(nullable(string())),
    ],
    dayTimeRestrictions: [
      'DayTimeRestrictions',
      optional(dayTimeRestrictionsSchema),
    ],
    productRestrictions: [
      'ProductRestrictions',
      optional(productRestrictionCardSchema),
    ],
    locationRestrictions: [
      'LocationRestrictions',
      optional(locationRestrictionSchema),
    ],
    usageRestrictions: [
      'UsageRestrictions',
      optional(usageRestrictionsCardSchema),
    ],
  })
);
