// Dependencies for this module:
//   ../../../../moment

import moment from 'moment';

export type SchedulerDateTime = Date | number | string;
export type AppointmentId = number | string;
/** Describes an appointment data object. */
export interface AppointmentModel {
  /** The start date. */
  startDate: SchedulerDateTime;
  /** The end date. */
  endDate?: SchedulerDateTime;
  /** The title. */
  title?: string;
  /** The all day flag. */
  allDay?: boolean;
  /** The identifier. */
  id?: number | string;
  /** Specifies the appointment recurrence rule. */
  rRule?: string | undefined;
  /** Specifies dates excluded from recurrence. */
  exDate?: string | undefined;
  /** Any other properties. */
  [propertyName: string]: any;
}
export interface Appointment {
  /** The start date. */
  start: SchedulerDateTime;
  /** The end date. */
  end: SchedulerDateTime;
  /** The all day flag. */
  allDay?: boolean;
  /** The recurrence rule. */
  rRule?: string;
  /** The exception date-times. */
  exDate?: string;
  /** The all appointment data */
  dataItem: AppointmentModel;
}
export interface TimeScale {
  start: Date;
  end: Date;
}
/** Describes an AllDay cell data configuration object. */
export type AllDayCell = {
  /** The cell’s start time. */
  startDate: SchedulerDateTime;
  /** The cell’s end time. */
  endDate?: SchedulerDateTime;
  /** Information about the cell's grouping. */
  groupingInfo?: Group[];
  /** \@deprecated Specifies whether the cell has the right border. */
  hasRightBorder?: boolean;
  /** "true" if this cell is last in its group. */
  endOfGroup?: boolean;
};
export type FormatterFn = (nextDate: SchedulerDateTime | undefined, nextOptions: Intl.DateTimeFormatOptions) => string;
/** Describes a current view object. */
export interface SchedulerView {
  /** View's unique identifier. */
  name: string;
  /** View's visible name. */
  displayName: string;
}
export type ScrollingStrategy = {
  topBoundary: number;
  bottomBoundary: number;
  leftBoundary: number;
  rightBoundary: number;
  fixedTopHeight?: number;
  fixedLeftWidth?: number;
  changeVerticalScroll: (value: number) => void;
  changeHorizontalScroll: (value: number) => void;
};
export type CellElementsMeta = {
  parentRect: () => ClientRect | DOMRect;
  getCellRects: Array<() => ClientRect | DOMRect>;
};

export type ViewCellData = {
  startDate: Date;
  endDate: Date;
  groupingInfo?: Group[];
};
export interface AppointmentMoment {
  start: moment.Moment;
  end: moment.Moment;
  title?: string;
  allDay?: boolean;
  id?: number | string;
  [propertyName: string]: any;
}

/** An option in the Select editor. */
export type SelectOption = {
  /** The option's text. */
  text: string;
  /** The option's id. */
  id: number | string;
};

/** An appointment's meta data object. */
export interface AppointmentMeta {
  /** A React component instance or a DOM element that is used to position the tooltip. */
  target: React.ReactInstance;
  /** The appointment's displayed metadata. */
  data: AppointmentModel;
}



export type AppointmentChanges = {
  [key: string]: object;
};
export type Changes = Partial<AppointmentModel>;
export type EditAppointmentPayload = {
  appointmentId: AppointmentId;
};
export type RecurrenceEditType = 'all' | 'currentAndFollowing' | 'current';
export type PreCommitChangesFn = (changes: Changes | null, appointmentData: Partial<AppointmentModel>, type: RecurrenceEditType) => ChangeSet;
/** Describes uncommitted changes made to the scheduler data. */
export interface ChangeSet {
  /** An array of rows to be created. */
  added?: {
    [key: string]: any;
  };
  /** An associative array that stores changes made to existing data. Each array item specifies changes made to a row. The item's key specifies the associated row's ID. */
  changed?: {
    [key: string]: any;
  };
  /** An array of IDs representing rows to be deleted. */
  deleted?: number | string;
}



/** Describes a cell data configuration object. */
export interface MonthCellData {
  /** Specifies the cell's start time. */
  startDate: Date;
  /** Specifies the cell's end time. */
  endDate: Date;
  /** Indicates whether the cell's date is not in the current month. */
  otherMonth: boolean;
  /** Indicates whether the cell's date is today. */
  today: boolean;
}



export interface ChangeCurrentDatePayload {
  nextDate: Date;
  step: 'day' | 'week' | 'month';
  amount: number;
  direction: string;
}





export type ClientOffset = {
  x: number;
  y: number;
};



/** Configures a resource. */
export type Resource = {
    /**
      * A data field name used to assign appointments to this resource.
      * This field should be present in appointment data objects.
      */
    fieldName: string;
    /** The resource title. */
    title?: string;
    /** Indicates whether an appointment can be assigned to several instances of this resource. */
    allowMultiple?: boolean;
    /** Resource instances. */
    instances: Array<ResourceInstance>;
};
/** Configures a resource instance. */
export type ResourceInstance = {
    /** The resource ID. */
    id: number | string;
    /** The resource instance color. */
    color?: string | Color;
    /** The resource instance text. */
    text?: string;
};
/**
  * Specifies a palette that provides colors for resource instances with undefined colors.
  */
export type Palette = Array<string | Color>;
/**
  * The [Material-UI Color](https://material-ui.com/customization/color/#color-palette) object.
  * See [these examples](https://material-ui.com/customization/color/#examples)
  * for information on how to use it.
  */
export interface Color {
    50: string;
    100: string;
    200: string;
    300: string;
    400: string;
    500: string;
    600: string;
    700: string;
    800: string;
    900: string;
    A100: string;
    A200: string;
    A400: string;
    A700: string;
}
/** An object that provides information about a resource instance. */
export type ValidResourceInstance = Required<ResourceInstance> & {
    /** The resource title. */
    title: string;
    /**
      * A data field name used to assign appointments to this resource.
      * This field should be present in appointment data objects.
      */
    fieldName: string;
    /** Indicates whether an appointment can be assigned to several instances of this resource. */
    allowMultiple: boolean;
    /** Specifies the main resource kind */
    isMain: boolean;
};
/** An object that provides information about a resource. */
export type ValidResource = {
    /**
      * A data field name used to assign appointments to this resource.
      * This field should be present in appointment data objects.
      */
    fieldName: string;
    /** The resource title. */
    title: string;
    /** Indicates whether an appointment can be assigned to several instances of this resource. */
    allowMultiple: boolean;
    /** Resource instances. */
    instances: Array<ValidResourceInstance>;
    /** Specifies the main resource kind */
    isMain: boolean;
};

/** Describes grouping options. */
export interface Grouping {
  /** The name of the resource by which the appointments are grouped. */
  resourceName: string;
}
/** Describes a group that can be nested in another one. */
export type GroupKey = string;
/** Describes group orientation (either Vertical or Horizontal) */
export type GroupOrientation = 'Vertical' | 'Horizontal';

/** Configures a single grouping item the appointments may belong to. */
export type Group = {
  /** The ID of the corresponding resource the appointments are grouped by. */
  id: number | string;
  /** The grouping item text. */
  text: string;
  /** The corresponding resource's filedName. */
  fieldName: string;
};





