enum SortDirectionEnum {
  ASC
  DESC
}

input FindFilterType {
  q: String
  page: Int
  "use per_page = -1 to indicate all results. Defaults to 25."
  per_page: Int
  # TODO - this should be refactored to not use a string
  sort: String
  direction: SortDirectionEnum
}

type SavedFindFilterType {
  q: String
  page: Int
  """
  use per_page = -1 to indicate all results. Defaults to 25.
  """
  per_page: Int
  sort: String
  direction: SortDirectionEnum
}

enum ResolutionEnum {
  "144p"
  VERY_LOW
  "240p"
  LOW
  "360p"
  R360P
  "480p"
  STANDARD
  "540p"
  WEB_HD
  "720p"
  STANDARD_HD
  "1080p"
  FULL_HD
  "1440p"
  QUAD_HD
  "1920p"
  VR_HD @deprecated(reason: "Use 4K instead")
  "4K"
  FOUR_K
  "5K"
  FIVE_K
  "6K"
  SIX_K
  "7K"
  SEVEN_K
  "8K"
  EIGHT_K
  "8K+"
  HUGE
}

input ResolutionCriterionInput {
  value: ResolutionEnum!
  modifier: CriterionModifier!
}

enum OrientationEnum {
  "Landscape"
  LANDSCAPE
  "Portrait"
  PORTRAIT
  "Square"
  SQUARE
}

input OrientationCriterionInput {
  value: [OrientationEnum!]!
}

input DuplicationCriterionInput {
  duplicated: Boolean @deprecated(reason: "Use phash field instead")
  "Currently unimplemented. Intended for phash distance matching."
  distance: Int
  "Filter by phash duplication"
  phash: Boolean
  "Filter by URL duplication"
  url: Boolean
  "Filter by Stash ID duplication"
  stash_id: Boolean
  "Filter by title duplication"
  title: Boolean
}

input FileDuplicationCriterionInput {
  duplicated: Boolean @deprecated(reason: "Use phash field instead")
  "Currently unimplemented. Intended for phash distance matching."
  distance: Int
  "Filter by phash duplication"
  phash: Boolean
}

input StashIDCriterionInput {
  """
  If present, this value is treated as a predicate.
  That is, it will filter based on stash_id with the matching endpoint
  """
  endpoint: String
  stash_id: String
  modifier: CriterionModifier!
}

input StashIDsCriterionInput {
  """
  If present, this value is treated as a predicate.
  That is, it will filter based on stash_ids with the matching endpoint
  """
  endpoint: String
  stash_ids: [String]
  modifier: CriterionModifier!
}

input CustomFieldCriterionInput {
  field: String!
  value: [Any!]
  modifier: CriterionModifier!
}

input PerformerFilterType {
  AND: PerformerFilterType
  OR: PerformerFilterType
  NOT: PerformerFilterType

  name: StringCriterionInput
  disambiguation: StringCriterionInput
  details: StringCriterionInput

  "Filter by favorite"
  filter_favorites: Boolean
  "Filter by birth year"
  birth_year: IntCriterionInput
  "Filter by age"
  age: IntCriterionInput
  "Filter by ethnicity"
  ethnicity: StringCriterionInput
  "Filter by country"
  country: StringCriterionInput
  "Filter by eye color"
  eye_color: StringCriterionInput
  "Filter by height in cm"
  height_cm: IntCriterionInput
  "Filter by measurements"
  measurements: StringCriterionInput
  "Filter by fake tits value"
  fake_tits: StringCriterionInput
  "Filter by penis length value"
  penis_length: FloatCriterionInput
  "Filter by circumcision"
  circumcised: CircumcisionCriterionInput
  "Deprecated: use career_start and career_end. This filter is non-functional."
  career_length: StringCriterionInput
    @deprecated(reason: "Use career_start and career_end")
  "Filter by career start"
  career_start: DateCriterionInput
  "Filter by career end"
  career_end: DateCriterionInput
  "Filter by tattoos"
  tattoos: StringCriterionInput
  "Filter by piercings"
  piercings: StringCriterionInput
  "Filter by aliases"
  aliases: StringCriterionInput
  "Filter by gender"
  gender: GenderCriterionInput
  "Filter to only include performers missing this property"
  is_missing: String
  "Filter to only include performers with these tags"
  tags: HierarchicalMultiCriterionInput
  "Filter by tag count"
  tag_count: IntCriterionInput
  "Filter by scene count"
  scene_count: IntCriterionInput
  "Filter by marker count (via scene)"
  marker_count: IntCriterionInput
  "Filter by image count"
  image_count: IntCriterionInput
  "Filter by gallery count"
  gallery_count: IntCriterionInput
  "Filter by play count"
  play_count: IntCriterionInput
  "Filter by o count"
  o_counter: IntCriterionInput
  "Filter by StashID"
  stash_id_endpoint: StashIDCriterionInput
    @deprecated(reason: "use stash_ids_endpoint instead")
  "Filter by StashIDs"
  stash_ids_endpoint: StashIDsCriterionInput
  # rating expressed as 1-100
  rating100: IntCriterionInput
  "Filter by url"
  url: StringCriterionInput
  "Filter by hair color"
  hair_color: StringCriterionInput
  "Filter by weight"
  weight: IntCriterionInput
  "Filter by death year"
  death_year: IntCriterionInput
  "Filter by studios where performer appears in scene/image/gallery"
  studios: HierarchicalMultiCriterionInput
  "Filter by groups where performer appears in scene"
  groups: HierarchicalMultiCriterionInput
  "Filter by performers where performer appears with another performer in scene/image/gallery"
  performers: MultiCriterionInput
  "Filter by autotag ignore value"
  ignore_auto_tag: Boolean
  "Filter by birthdate"
  birthdate: DateCriterionInput
  "Filter by death date"
  death_date: DateCriterionInput
  "Filter by related scenes that meet this criteria"
  scenes_filter: SceneFilterType
  "Filter by related images that meet this criteria"
  images_filter: ImageFilterType
  "Filter by related galleries that meet this criteria"
  galleries_filter: GalleryFilterType
  "Filter by related tags that meet this criteria"
  tags_filter: TagFilterType
  "Filter by related scene markers (via scene) that meet this criteria"
  markers_filter: SceneMarkerFilterType
  "Filter by creation time"
  created_at: TimestampCriterionInput
  "Filter by last update time"
  updated_at: TimestampCriterionInput

  custom_fields: [CustomFieldCriterionInput!]
}

input SceneMarkerFilterType {
  "Filter to only include scene markers with these tags"
  tags: HierarchicalMultiCriterionInput
  "Filter to only include scene markers attached to a scene with these tags"
  scene_tags: HierarchicalMultiCriterionInput
  "Filter to only include scene markers with these performers"
  performers: MultiCriterionInput
  "Filter to only include scene markers from these scenes"
  scenes: MultiCriterionInput
  "Filter by duration (in seconds)"
  duration: FloatCriterionInput
  "Filter by creation time"
  created_at: TimestampCriterionInput
  "Filter by last update time"
  updated_at: TimestampCriterionInput
  "Filter by scene date"
  scene_date: DateCriterionInput
  "Filter by scene creation time"
  scene_created_at: TimestampCriterionInput
  "Filter by scene last update time"
  scene_updated_at: TimestampCriterionInput
  "Filter by related scenes that meet this criteria"
  scene_filter: SceneFilterType
}

input SceneFilterType {
  AND: SceneFilterType
  OR: SceneFilterType
  NOT: SceneFilterType

  id: IntCriterionInput
  title: StringCriterionInput
  code: StringCriterionInput
  details: StringCriterionInput
  director: StringCriterionInput

  "Filter by file oshash"
  oshash: StringCriterionInput
  "Filter by file checksum"
  checksum: StringCriterionInput
  "Filter by file phash"
  phash: StringCriterionInput @deprecated(reason: "Use phash_distance instead")
  "Filter by file phash distance"
  phash_distance: PhashDistanceCriterionInput
  "Filter by path"
  path: StringCriterionInput
  "Filter by file count"
  file_count: IntCriterionInput
  # rating expressed as 1-100
  rating100: IntCriterionInput
  "Filter by organized"
  organized: Boolean
  "Filter by o-counter"
  o_counter: IntCriterionInput
  "Filter Scenes by duplication criteria"
  duplicated: DuplicationCriterionInput
  "Filter by resolution"
  resolution: ResolutionCriterionInput
  "Filter by orientation"
  orientation: OrientationCriterionInput
  "Filter by frame rate"
  framerate: IntCriterionInput
  "Filter by bit rate"
  bitrate: IntCriterionInput
  "Filter by video codec"
  video_codec: StringCriterionInput
  "Filter by audio codec"
  audio_codec: StringCriterionInput
  "Filter by duration (in seconds)"
  duration: IntCriterionInput
  "Filter to only include scenes which have markers. `true` or `false`"
  has_markers: String
  "Filter to only include scenes missing this property"
  is_missing: String
  "Filter to only include scenes with this studio"
  studios: HierarchicalMultiCriterionInput
  "Filter to only include scenes with this movie"
  movies: MultiCriterionInput @deprecated(reason: "use groups instead")
  "Filter to only include scenes with this group"
  groups: HierarchicalMultiCriterionInput
  "Filter to only include scenes with this gallery"
  galleries: MultiCriterionInput
  "Filter to only include scenes with these tags"
  tags: HierarchicalMultiCriterionInput
  "Filter by tag count"
  tag_count: IntCriterionInput
  "Filter to only include scenes with performers with these tags"
  performer_tags: HierarchicalMultiCriterionInput
  "Filter scenes that have performers that have been favorited"
  performer_favorite: Boolean
  "Filter scenes by performer age at time of scene"
  performer_age: IntCriterionInput
  "Filter to only include scenes with these performers"
  performers: MultiCriterionInput
  "Filter by performer count"
  performer_count: IntCriterionInput
  "Filter by StashID"
  stash_id_endpoint: StashIDCriterionInput
    @deprecated(reason: "use stash_ids_endpoint instead")
  "Filter by StashIDs"
  stash_ids_endpoint: StashIDsCriterionInput
  "Filter by StashID count"
  stash_id_count: IntCriterionInput
  "Filter by url"
  url: StringCriterionInput
  "Filter by interactive"
  interactive: Boolean
  "Filter by InteractiveSpeed"
  interactive_speed: IntCriterionInput
  "Filter by captions"
  captions: StringCriterionInput
  "Filter by resume time"
  resume_time: IntCriterionInput
  "Filter by play count"
  play_count: IntCriterionInput
  "Filter by play duration (in seconds)"
  play_duration: IntCriterionInput
  "Filter by scene last played time"
  last_played_at: TimestampCriterionInput
  "Filter by date"
  date: DateCriterionInput
  "Filter by creation time"
  created_at: TimestampCriterionInput
  "Filter by last update time"
  updated_at: TimestampCriterionInput

  "Filter by related galleries that meet this criteria"
  galleries_filter: GalleryFilterType
  "Filter by related performers that meet this criteria"
  performers_filter: PerformerFilterType
  "Filter by related studios that meet this criteria"
  studios_filter: StudioFilterType
  "Filter by related tags that meet this criteria"
  tags_filter: TagFilterType
  "Filter by related movies that meet this criteria"
  movies_filter: MovieFilterType
    @deprecated(reason: "use groups_filter instead")
  "Filter by related groups that meet this criteria"
  groups_filter: GroupFilterType
  "Filter by related markers that meet this criteria"
  markers_filter: SceneMarkerFilterType
  "Filter by related files that meet this criteria"
  files_filter: FileFilterType

  custom_fields: [CustomFieldCriterionInput!]
}

input MovieFilterType {
  AND: MovieFilterType
  OR: MovieFilterType
  NOT: MovieFilterType

  name: StringCriterionInput
  director: StringCriterionInput
  synopsis: StringCriterionInput

  "Filter by duration (in seconds)"
  duration: IntCriterionInput
  # rating expressed as 1-100
  rating100: IntCriterionInput
  "Filter to only include movies with this studio"
  studios: HierarchicalMultiCriterionInput
  "Filter to only include movies missing this property"
  is_missing: String
  "Filter by url"
  url: StringCriterionInput
  "Filter to only include movies where performer appears in a scene"
  performers: MultiCriterionInput
  "Filter to only include movies with these tags"
  tags: HierarchicalMultiCriterionInput
  "Filter by tag count"
  tag_count: IntCriterionInput
  "Filter by date"
  date: DateCriterionInput
  "Filter by creation time"
  created_at: TimestampCriterionInput
  "Filter by last update time"
  updated_at: TimestampCriterionInput

  "Filter by related scenes that meet this criteria"
  scenes_filter: SceneFilterType
  "Filter by related studios that meet this criteria"
  studios_filter: StudioFilterType
}

input GroupFilterType {
  AND: GroupFilterType
  OR: GroupFilterType
  NOT: GroupFilterType

  name: StringCriterionInput
  director: StringCriterionInput
  synopsis: StringCriterionInput

  "Filter by duration (in seconds)"
  duration: IntCriterionInput
  # rating expressed as 1-100
  rating100: IntCriterionInput
  "Filter to only include groups with this studio"
  studios: HierarchicalMultiCriterionInput
  "Filter to only include groups missing this property"
  is_missing: String
  "Filter by url"
  url: StringCriterionInput
  "Filter to only include groups where performer appears in a scene"
  performers: MultiCriterionInput
  "Filter to only include groups with these tags"
  tags: HierarchicalMultiCriterionInput
  "Filter by tag count"
  tag_count: IntCriterionInput
  "Filter by date"
  date: DateCriterionInput
  "Filter by creation time"
  created_at: TimestampCriterionInput
  "Filter by last update time"
  updated_at: TimestampCriterionInput
  "Filter by o-counter"
  o_counter: IntCriterionInput

  "Filter by containing groups"
  containing_groups: HierarchicalMultiCriterionInput
  "Filter by sub groups"
  sub_groups: HierarchicalMultiCriterionInput
  "Filter by number of containing groups the group has"
  containing_group_count: IntCriterionInput
  "Filter by number of sub-groups the group has"
  sub_group_count: IntCriterionInput
  "Filter by number of scenes the group has"
  scene_count: IntCriterionInput

  "Filter by related scenes that meet this criteria"
  scenes_filter: SceneFilterType
  "Filter by related studios that meet this criteria"
  studios_filter: StudioFilterType

  "Filter by custom fields"
  custom_fields: [CustomFieldCriterionInput!]
}

input StudioFilterType {
  AND: StudioFilterType
  OR: StudioFilterType
  NOT: StudioFilterType

  name: StringCriterionInput
  details: StringCriterionInput
  "Filter to only include studios with this parent studio"
  parents: MultiCriterionInput
  "Filter by StashID"
  stash_id_endpoint: StashIDCriterionInput
    @deprecated(reason: "use stash_ids_endpoint instead")
  "Filter by StashIDs"
  stash_ids_endpoint: StashIDsCriterionInput
  "Filter to only include studios with these tags"
  tags: HierarchicalMultiCriterionInput
  "Filter to only include studios missing this property"
  is_missing: String
  # rating expressed as 1-100
  rating100: IntCriterionInput
  "Filter by favorite"
  favorite: Boolean
  "Filter by scene count"
  scene_count: IntCriterionInput
  "Filter by image count"
  image_count: IntCriterionInput
  "Filter by gallery count"
  gallery_count: IntCriterionInput
  "Filter by group count"
  group_count: IntCriterionInput
  "Filter by tag count"
  tag_count: IntCriterionInput
  "Filter by url"
  url: StringCriterionInput
  "Filter by studio aliases"
  aliases: StringCriterionInput
  "Filter by subsidiary studio count"
  child_count: IntCriterionInput
  "Filter by autotag ignore value"
  ignore_auto_tag: Boolean
  "Filter by organized"
  organized: Boolean
  "Filter by related scenes that meet this criteria"
  scenes_filter: SceneFilterType
  "Filter by related images that meet this criteria"
  images_filter: ImageFilterType
  "Filter by related galleries that meet this criteria"
  galleries_filter: GalleryFilterType
  "Filter by related groups that meet this criteria"
  groups_filter: GroupFilterType
  "Filter by creation time"
  created_at: TimestampCriterionInput
  "Filter by last update time"
  updated_at: TimestampCriterionInput

  custom_fields: [CustomFieldCriterionInput!]
}

input GalleryFilterType {
  AND: GalleryFilterType
  OR: GalleryFilterType
  NOT: GalleryFilterType

  id: IntCriterionInput
  title: StringCriterionInput
  details: StringCriterionInput

  "Filter by file checksum"
  checksum: StringCriterionInput
  "Filter by path"
  path: StringCriterionInput
  "Filter by zip-file count"
  file_count: IntCriterionInput
  "Filter to only include galleries missing this property"
  is_missing: String
  "Filter to include/exclude galleries that were created from zip"
  is_zip: Boolean
  # rating expressed as 1-100
  rating100: IntCriterionInput
  "Filter by organized"
  organized: Boolean
  "Filter by average image resolution"
  average_resolution: ResolutionCriterionInput
  "Filter to only include galleries that have chapters. `true` or `false`"
  has_chapters: String
  "Filter to only include galleries with these scenes"
  scenes: MultiCriterionInput
  "Filter to only include galleries with this studio"
  studios: HierarchicalMultiCriterionInput
  "Filter to only include galleries with these tags"
  tags: HierarchicalMultiCriterionInput
  "Filter by tag count"
  tag_count: IntCriterionInput
  "Filter to only include galleries with performers with these tags"
  performer_tags: HierarchicalMultiCriterionInput
  "Filter to only include galleries with these performers"
  performers: MultiCriterionInput
  "Filter by performer count"
  performer_count: IntCriterionInput
  "Filter galleries that have performers that have been favorited"
  performer_favorite: Boolean
  "Filter galleries by performer age at time of gallery"
  performer_age: IntCriterionInput
  "Filter by number of images in this gallery"
  image_count: IntCriterionInput
  "Filter by url"
  url: StringCriterionInput
  "Filter by date"
  date: DateCriterionInput
  "Filter by creation time"
  created_at: TimestampCriterionInput
  "Filter by last update time"
  updated_at: TimestampCriterionInput
  "Filter by studio code"
  code: StringCriterionInput
  "Filter by photographer"
  photographer: StringCriterionInput

  "Filter by related scenes that meet this criteria"
  scenes_filter: SceneFilterType
  "Filter by related images that meet this criteria"
  images_filter: ImageFilterType
  "Filter by related performers that meet this criteria"
  performers_filter: PerformerFilterType
  "Filter by related studios that meet this criteria"
  studios_filter: StudioFilterType
  "Filter by related tags that meet this criteria"
  tags_filter: TagFilterType
  "Filter by related files that meet this criteria"
  files_filter: FileFilterType
  "Filter by related folders that meet this criteria"
  folders_filter: FolderFilterType
  "Filter by parent folder of the zip or folder the gallery is in"
  parent_folder: HierarchicalMultiCriterionInput

  custom_fields: [CustomFieldCriterionInput!]
}

input TagFilterType {
  AND: TagFilterType
  OR: TagFilterType
  NOT: TagFilterType

  "Filter by tag name"
  name: StringCriterionInput

  "Filter by tag sort_name"
  sort_name: StringCriterionInput

  "Filter by tag aliases"
  aliases: StringCriterionInput

  "Filter by favorite"
  favorite: Boolean

  "Filter by tag description"
  description: StringCriterionInput

  "Filter to only include tags missing this property"
  is_missing: String

  "Filter by number of scenes with this tag"
  scene_count: IntCriterionInput

  "Filter by number of images with this tag"
  image_count: IntCriterionInput

  "Filter by number of galleries with this tag"
  gallery_count: IntCriterionInput

  "Filter by number of performers with this tag"
  performer_count: IntCriterionInput

  "Filter by number of studios with this tag"
  studio_count: IntCriterionInput

  "Filter by number of movies with this tag"
  movie_count: IntCriterionInput

  "Filter by number of group with this tag"
  group_count: IntCriterionInput

  "Filter by number of markers with this tag"
  marker_count: IntCriterionInput

  "Filter by parent tags"
  parents: HierarchicalMultiCriterionInput

  "Filter by child tags"
  children: HierarchicalMultiCriterionInput

  "Filter by number of parent tags the tag has"
  parent_count: IntCriterionInput

  "Filter by number of child tags the tag has"
  child_count: IntCriterionInput

  "Filter by autotag ignore value"
  ignore_auto_tag: Boolean

  "Filter by StashID"
  stash_id_endpoint: StashIDCriterionInput
    @deprecated(reason: "use stash_ids_endpoint instead")

  "Filter by StashID"
  stash_ids_endpoint: StashIDsCriterionInput

  "Filter by related scenes that meet this criteria"
  scenes_filter: SceneFilterType
  "Filter by related images that meet this criteria"
  images_filter: ImageFilterType
  "Filter by related galleries that meet this criteria"
  galleries_filter: GalleryFilterType
  "Filter by related groups that meet this criteria"
  groups_filter: GroupFilterType
  "Filter by related performers that meet this criteria"
  performers_filter: PerformerFilterType
  "Filter by related studios that meet this criteria"
  studios_filter: StudioFilterType
  "Filter by related scene markers that meet this criteria"
  markers_filter: SceneMarkerFilterType

  "Filter by creation time"
  created_at: TimestampCriterionInput

  "Filter by last update time"
  updated_at: TimestampCriterionInput

  custom_fields: [CustomFieldCriterionInput!]
}

input ImageFilterType {
  AND: ImageFilterType
  OR: ImageFilterType
  NOT: ImageFilterType

  title: StringCriterionInput
  details: StringCriterionInput

  " Filter by image id"
  id: IntCriterionInput
  "Filter by file checksum"
  checksum: StringCriterionInput
  "Filter by file phash distance"
  phash_distance: PhashDistanceCriterionInput
  "Filter by path"
  path: StringCriterionInput
  "Filter by file count"
  file_count: IntCriterionInput
  # rating expressed as 1-100
  rating100: IntCriterionInput
  "Filter by date"
  date: DateCriterionInput
  "Filter by url"
  url: StringCriterionInput
  "Filter by organized"
  organized: Boolean
  "Filter by o-counter"
  o_counter: IntCriterionInput
  "Filter by resolution"
  resolution: ResolutionCriterionInput
  "Filter by orientation"
  orientation: OrientationCriterionInput
  "Filter to only include images missing this property"
  is_missing: String
  "Filter to only include images with this studio"
  studios: HierarchicalMultiCriterionInput
  "Filter to only include images with these tags"
  tags: HierarchicalMultiCriterionInput
  "Filter by tag count"
  tag_count: IntCriterionInput
  "Filter to only include images with performers with these tags"
  performer_tags: HierarchicalMultiCriterionInput
  "Filter to only include images with these performers"
  performers: MultiCriterionInput
  "Filter by performer count"
  performer_count: IntCriterionInput
  "Filter images that have performers that have been favorited"
  performer_favorite: Boolean
  "Filter images by performer age at time of image"
  performer_age: IntCriterionInput
  "Filter to only include images with these galleries"
  galleries: MultiCriterionInput
  "Filter by creation time"
  created_at: TimestampCriterionInput
  "Filter by last update time"
  updated_at: TimestampCriterionInput
  "Filter by studio code"
  code: StringCriterionInput
  "Filter by photographer"
  photographer: StringCriterionInput

  "Filter by related galleries that meet this criteria"
  galleries_filter: GalleryFilterType
  "Filter by related performers that meet this criteria"
  performers_filter: PerformerFilterType
  "Filter by related studios that meet this criteria"
  studios_filter: StudioFilterType
  "Filter by related tags that meet this criteria"
  tags_filter: TagFilterType
  "Filter by related files that meet this criteria"
  files_filter: FileFilterType
  "Filter by custom fields"
  custom_fields: [CustomFieldCriterionInput!]
}

input FileFilterType {
  AND: FileFilterType
  OR: FileFilterType
  NOT: FileFilterType

  path: StringCriterionInput
  basename: StringCriterionInput
  dir: StringCriterionInput

  parent_folder: HierarchicalMultiCriterionInput
  zip_file: MultiCriterionInput

  "Filter by modification time"
  mod_time: TimestampCriterionInput

  "Filter files by duplication criteria (only phash applies to files)"
  duplicated: FileDuplicationCriterionInput

  "find files based on hash"
  hashes: [FingerprintFilterInput!]

  video_file_filter: VideoFileFilterInput
  image_file_filter: ImageFileFilterInput

  scene_count: IntCriterionInput
  image_count: IntCriterionInput
  gallery_count: IntCriterionInput

  "Filter by related scenes that meet this criteria"
  scenes_filter: SceneFilterType
  "Filter by related images that meet this criteria"
  images_filter: ImageFilterType
  "Filter by related galleries that meet this criteria"
  galleries_filter: GalleryFilterType

  "Filter by creation time"
  created_at: TimestampCriterionInput
  "Filter by last update time"
  updated_at: TimestampCriterionInput
}

input FolderFilterType {
  AND: FolderFilterType
  OR: FolderFilterType
  NOT: FolderFilterType

  path: StringCriterionInput
  basename: StringCriterionInput

  parent_folder: HierarchicalMultiCriterionInput
  zip_file: MultiCriterionInput

  "Filter by modification time"
  mod_time: TimestampCriterionInput

  gallery_count: IntCriterionInput

  "Filter by files that meet this criteria"
  files_filter: FileFilterType
  "Filter by related galleries that meet this criteria"
  galleries_filter: GalleryFilterType

  "Filter by creation time"
  created_at: TimestampCriterionInput
  "Filter by last update time"
  updated_at: TimestampCriterionInput
}

input VideoFileFilterInput {
  resolution: ResolutionCriterionInput
  orientation: OrientationCriterionInput
  framerate: IntCriterionInput
  bitrate: IntCriterionInput
  format: StringCriterionInput
  video_codec: StringCriterionInput
  audio_codec: StringCriterionInput

  "in seconds"
  duration: IntCriterionInput

  captions: StringCriterionInput

  interactive: Boolean
  interactive_speed: IntCriterionInput
}

input ImageFileFilterInput {
  format: StringCriterionInput
  resolution: ResolutionCriterionInput
  orientation: OrientationCriterionInput
}

input FingerprintFilterInput {
  type: String!
  value: String!
  "Hamming distance - defaults to 0"
  distance: Int
}

enum CriterionModifier {
  "="
  EQUALS
  "!="
  NOT_EQUALS
  ">"
  GREATER_THAN
  "<"
  LESS_THAN
  "IS NULL"
  IS_NULL
  "IS NOT NULL"
  NOT_NULL
  "INCLUDES ALL"
  INCLUDES_ALL
  INCLUDES
  EXCLUDES
  "MATCHES REGEX"
  MATCHES_REGEX
  "NOT MATCHES REGEX"
  NOT_MATCHES_REGEX
  ">= AND <="
  BETWEEN
  "< OR >"
  NOT_BETWEEN
}

input StringCriterionInput {
  value: String!
  modifier: CriterionModifier!
}

input IntCriterionInput {
  value: Int!
  value2: Int
  modifier: CriterionModifier!
}

input FloatCriterionInput {
  value: Float!
  value2: Float
  modifier: CriterionModifier!
}

input MultiCriterionInput {
  value: [ID!]
  modifier: CriterionModifier!
  excludes: [ID!]
}

input GenderCriterionInput {
  value: GenderEnum
  value_list: [GenderEnum!]
  modifier: CriterionModifier!
}

input CircumcisionCriterionInput {
  value: [CircumcisedEnum!]
  modifier: CriterionModifier!
}

input HierarchicalMultiCriterionInput {
  value: [ID!]
  modifier: CriterionModifier!
  depth: Int
  excludes: [ID!]
}

input DateCriterionInput {
  value: String!
  value2: String
  modifier: CriterionModifier!
}

input TimestampCriterionInput {
  value: String!
  value2: String
  modifier: CriterionModifier!
}

input PhashDistanceCriterionInput {
  value: String!
  modifier: CriterionModifier!
  distance: Int
}

enum FilterMode {
  SCENES
  PERFORMERS
  STUDIOS
  GALLERIES
  SCENE_MARKERS
  MOVIES
  GROUPS
  TAGS
  IMAGES
}

type SavedFilter {
  id: ID!
  mode: FilterMode!
  name: String!
  "JSON-encoded filter string"
  filter: String!
    @deprecated(reason: "use find_filter and object_filter instead")
  find_filter: SavedFindFilterType
  # maps to any of the AnyFilterInput types
  # using a generic Map instead of creating and maintaining match types for inputs
  object_filter: Map
  # generic map for ui options
  ui_options: Map
}

input SaveFilterInput {
  "provide ID to overwrite existing filter"
  id: ID
  mode: FilterMode!
  name: String!
  find_filter: FindFilterType
  object_filter: Map
  # generic map for ui options
  ui_options: Map
}

input DestroyFilterInput {
  id: ID!
}

input SetDefaultFilterInput {
  mode: FilterMode!
  "null to clear"
  find_filter: FindFilterType
  object_filter: Map
  # generic map for ui options
  ui_options: Map
}
