input GenerateMetadataInput {
  covers: Boolean
  sprites: Boolean
  previews: Boolean
  imagePreviews: Boolean
  previewOptions: GeneratePreviewOptionsInput
  markers: Boolean
  markerImagePreviews: Boolean
  markerScreenshots: Boolean
  transcodes: Boolean
  "Generate transcodes even if not required"
  forceTranscodes: Boolean
  phashes: Boolean
  interactiveHeatmapsSpeeds: Boolean
  imageThumbnails: Boolean
  clipPreviews: Boolean

  "scene ids to generate for"
  sceneIDs: [ID!]
  "marker ids to generate for"
  markerIDs: [ID!]

  "overwrite existing media"
  overwrite: Boolean
}

input GeneratePreviewOptionsInput {
  "Number of segments in a preview file"
  previewSegments: Int
  "Preview segment duration, in seconds"
  previewSegmentDuration: Float
  "Duration of start of video to exclude when generating previews"
  previewExcludeStart: String
  "Duration of end of video to exclude when generating previews"
  previewExcludeEnd: String
  "Preset when generating preview"
  previewPreset: PreviewPreset
}

type GenerateMetadataOptions {
  covers: Boolean
  sprites: Boolean
  previews: Boolean
  imagePreviews: Boolean
  previewOptions: GeneratePreviewOptions
  markers: Boolean
  markerImagePreviews: Boolean
  markerScreenshots: Boolean
  transcodes: Boolean
  phashes: Boolean
  interactiveHeatmapsSpeeds: Boolean
  imageThumbnails: Boolean
  clipPreviews: Boolean
}

type GeneratePreviewOptions {
  "Number of segments in a preview file"
  previewSegments: Int
  "Preview segment duration, in seconds"
  previewSegmentDuration: Float
  "Duration of start of video to exclude when generating previews"
  previewExcludeStart: String
  "Duration of end of video to exclude when generating previews"
  previewExcludeEnd: String
  "Preset when generating preview"
  previewPreset: PreviewPreset
}

"Filter options for meta data scannning"
input ScanMetaDataFilterInput {
  "If set, files with a modification time before this time point are ignored by the scan"
  minModTime: Timestamp
}

input ScanMetadataInput {
  paths: [String!]

  "Forces a rescan on files even if modification time is unchanged"
  rescan: Boolean
  "Generate covers during scan"
  scanGenerateCovers: Boolean
  "Generate previews during scan"
  scanGeneratePreviews: Boolean
  "Generate image previews during scan"
  scanGenerateImagePreviews: Boolean
  "Generate sprites during scan"
  scanGenerateSprites: Boolean
  "Generate phashes during scan"
  scanGeneratePhashes: Boolean
  "Generate image thumbnails during scan"
  scanGenerateThumbnails: Boolean
  "Generate image clip previews during scan"
  scanGenerateClipPreviews: Boolean

  "Filter options for the scan"
  filter: ScanMetaDataFilterInput
}

type ScanMetadataOptions {
  "Forces a rescan on files even if modification time is unchanged"
  rescan: Boolean!
  "Generate covers during scan"
  scanGenerateCovers: Boolean!
  "Generate previews during scan"
  scanGeneratePreviews: Boolean!
  "Generate image previews during scan"
  scanGenerateImagePreviews: Boolean!
  "Generate sprites during scan"
  scanGenerateSprites: Boolean!
  "Generate phashes during scan"
  scanGeneratePhashes: Boolean!
  "Generate image thumbnails during scan"
  scanGenerateThumbnails: Boolean!
  "Generate image clip previews during scan"
  scanGenerateClipPreviews: Boolean!
}

input CleanMetadataInput {
  paths: [String!]

  "Do a dry run. Don't delete any files"
  dryRun: Boolean!
}

input CleanGeneratedInput {
  "Clean blob files without blob entries"
  blobFiles: Boolean
  "Clean sprite and vtt files without scene entries"
  sprites: Boolean
  "Clean preview files without scene entries"
  screenshots: Boolean
  "Clean scene transcodes without scene entries"
  transcodes: Boolean

  "Clean marker files without marker entries"
  markers: Boolean

  "Clean image thumbnails/clips without image entries"
  imageThumbnails: Boolean

  "Do a dry run. Don't delete any files"
  dryRun: Boolean
}

input AutoTagMetadataInput {
  "Paths to tag, null for all files"
  paths: [String!]
  """
  IDs of performers to tag files with, or "*" for all
  """
  performers: [String!]
  """
  IDs of studios to tag files with, or "*" for all
  """
  studios: [String!]
  """
  IDs of tags to tag files with, or "*" for all
  """
  tags: [String!]
}

type AutoTagMetadataOptions {
  """
  IDs of performers to tag files with, or "*" for all
  """
  performers: [String!]
  """
  IDs of studios to tag files with, or "*" for all
  """
  studios: [String!]
  """
  IDs of tags to tag files with, or "*" for all
  """
  tags: [String!]
}

enum IdentifyFieldStrategy {
  "Never sets the field value"
  IGNORE
  """
  For multi-value fields, merge with existing.
  For single-value fields, ignore if already set
  """
  MERGE
  """
  Always replaces the value if a value is found.
  For multi-value fields, any existing values are removed and replaced with the
  scraped values.
  """
  OVERWRITE
}

input IdentifyFieldOptionsInput {
  field: String!
  strategy: IdentifyFieldStrategy!
  "creates missing objects if needed - only applicable for performers, tags and studios"
  createMissing: Boolean
}

input IdentifyMetadataOptionsInput {
  "any fields missing from here are defaulted to MERGE and createMissing false"
  fieldOptions: [IdentifyFieldOptionsInput!]
  "defaults to true if not provided"
  setCoverImage: Boolean
  setOrganized: Boolean
  "defaults to true if not provided"
  includeMalePerformers: Boolean
  "defaults to true if not provided"
  skipMultipleMatches: Boolean
  "tag to tag skipped multiple matches with"
  skipMultipleMatchTag: String
  "defaults to true if not provided"
  skipSingleNamePerformers: Boolean
  "tag to tag skipped single name performers with"
  skipSingleNamePerformerTag: String
}

input IdentifySourceInput {
  source: ScraperSourceInput!
  "Options defined for a source override the defaults"
  options: IdentifyMetadataOptionsInput
}

input IdentifyMetadataInput {
  "An ordered list of sources to identify items with. Only the first source that finds a match is used."
  sources: [IdentifySourceInput!]!
  "Options defined here override the configured defaults"
  options: IdentifyMetadataOptionsInput

  "scene ids to identify"
  sceneIDs: [ID!]

  "paths of scenes to identify - ignored if scene ids are set"
  paths: [String!]
}

# types for default options
type IdentifyFieldOptions {
  field: String!
  strategy: IdentifyFieldStrategy!
  "creates missing objects if needed - only applicable for performers, tags and studios"
  createMissing: Boolean
}

type IdentifyMetadataOptions {
  "any fields missing from here are defaulted to MERGE and createMissing false"
  fieldOptions: [IdentifyFieldOptions!]
  "defaults to true if not provided"
  setCoverImage: Boolean
  setOrganized: Boolean
  "defaults to true if not provided"
  includeMalePerformers: Boolean
  "defaults to true if not provided"
  skipMultipleMatches: Boolean
  "tag to tag skipped multiple matches with"
  skipMultipleMatchTag: String
  "defaults to true if not provided"
  skipSingleNamePerformers: Boolean
  "tag to tag skipped single name performers with"
  skipSingleNamePerformerTag: String
}

type IdentifySource {
  source: ScraperSource!
  "Options defined for a source override the defaults"
  options: IdentifyMetadataOptions
}

type IdentifyMetadataTaskOptions {
  "An ordered list of sources to identify items with. Only the first source that finds a match is used."
  sources: [IdentifySource!]!
  "Options defined here override the configured defaults"
  options: IdentifyMetadataOptions
}

input ExportObjectTypeInput {
  ids: [String!]
  all: Boolean
}

input ExportObjectsInput {
  scenes: ExportObjectTypeInput
  images: ExportObjectTypeInput
  studios: ExportObjectTypeInput
  performers: ExportObjectTypeInput
  tags: ExportObjectTypeInput
  movies: ExportObjectTypeInput
  galleries: ExportObjectTypeInput
  includeDependencies: Boolean
}

enum ImportDuplicateEnum {
  IGNORE
  OVERWRITE
  FAIL
}

enum ImportMissingRefEnum {
  IGNORE
  FAIL
  CREATE
}

input ImportObjectsInput {
  file: Upload!
  duplicateBehaviour: ImportDuplicateEnum!
  missingRefBehaviour: ImportMissingRefEnum!
}

input BackupDatabaseInput {
  download: Boolean
}

input AnonymiseDatabaseInput {
  download: Boolean
}

enum SystemStatusEnum {
  SETUP
  NEEDS_MIGRATION
  OK
}

type SystemStatus {
  databaseSchema: Int
  databasePath: String
  configPath: String
  appSchema: Int!
  status: SystemStatusEnum!
  os: String!
  workingDir: String!
  homeDir: String!
  ffmpegPath: String
  ffprobePath: String
}

input MigrateInput {
  backupPath: String!
}
