# ===============================================
# SITES
# ===============================================

extend type Query {
  sites: [Site]

  siteById (
    id: UUID!
  ): Site

  siteByHostname (
    hostname: String!
    exact: Boolean!
  ): Site
}

extend type Mutation {
  createSite (
    hostname: String!
    title: String!
  ): SiteCreateResponse

  updateSite (
    id: UUID!
    patch: SiteUpdateInput!
  ): DefaultResponse

  uploadSiteLogo (
    id: UUID!
    image: Upload!
  ): DefaultResponse

  uploadSiteFavicon (
    id: UUID!
    image: Upload!
  ): DefaultResponse

  deleteSite (
    id: UUID!
  ): DefaultResponse
}

# -----------------------------------------------
# TYPES
# -----------------------------------------------

type Site {
  id: UUID
  hostname: String
  isEnabled: Boolean
  title: String
  description: String
  company: String
  contentLicense: String
  footerExtra: String
  pageExtensions: String
  logoText: Boolean
  sitemap: Boolean
  robots: SiteRobots
  features: SiteFeatures
  defaults: SiteDefaults
  locale: String
  localeNamespaces: [String]
  localeNamespacing: Boolean
  theme: SiteTheme
}

type SiteRobots {
  index: Boolean
  follow: Boolean
}

type SiteFeatures {
  ratings: Boolean
  ratingsMode: SitePageRatingModes
  comments: Boolean
  contributions: Boolean
  profile: Boolean
  search: Boolean
}

type SiteDefaults {
  timezone: String
  dateFormat: String
  timeFormat: String
}

type SiteLocale {
  locale: String
  autoUpdate: Boolean
  namespacing: Boolean
  namespaces: [String]
}

type SiteTheme {
  dark: Boolean
  colorPrimary: String
  colorSecondary: String
  colorAccent: String
  colorHeader: String
  colorSidebar: String
  injectCSS: String
  injectHead: String
  injectBody: String
  contentWidth: SiteThemeWidth
  sidebarPosition: SiteThemePosition
  tocPosition: SiteThemePosition
  showSharingMenu: Boolean
  showPrintBtn: Boolean
  baseFont: String
  contentFont: String
}

enum SiteThemeWidth {
  full
  centered
}

enum SiteThemePosition {
  off
  left
  right
}

enum SitePageRatingModes {
  off
  thumbs
  stars
}

type SiteCreateResponse {
  operation: Operation
  site: Site
}

input SiteUpdateInput {
  hostname: String
  isEnabled: Boolean
  title: String
  description: String
  company: String
  contentLicense: String
  footerExtra: String
  pageExtensions: String
  logoText: Boolean
  sitemap: Boolean
  robots: SiteRobotsInput
  features: SiteFeaturesInput
  defaults: SiteDefaultsInput
  theme: SiteThemeInput
}

input SiteRobotsInput {
  index: Boolean
  follow: Boolean
}

input SiteFeaturesInput {
  ratings: Boolean
  ratingsMode: SitePageRatingModes
  comments: Boolean
  contributions: Boolean
  profile: Boolean
  search: Boolean
}

input SiteDefaultsInput {
  timezone: String
  dateFormat: String
  timeFormat: String
}

input SiteThemeInput {
  dark: Boolean
  colorPrimary: String
  colorSecondary: String
  colorAccent: String
  colorHeader: String
  colorSidebar: String
  injectCSS: String
  injectHead: String
  injectBody: String
  contentWidth: SiteThemeWidth
  sidebarPosition: SiteThemePosition
  tocPosition: SiteThemePosition
  showSharingMenu: Boolean
  showPrintBtn: Boolean
  baseFont: String
  contentFont: String
}
