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

import {
  lazy,
  nullable,
  object,
  optional,
  Schema,
  string,
  unknown,
} from '../schema';
import {
  DayTimeRestrictions,
  dayTimeRestrictionsSchema,
} from './dayTimeRestrictions';
import {
  LocationRestriction,
  locationRestrictionSchema,
} from './locationRestriction';

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;
  usageRestrictions?: unknown;
  dayTimeRestrictions?: DayTimeRestrictions;
  productRestrictions?: unknown;
  locationRestrictions?: LocationRestriction;
}

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