# import PaginatorParts from './paginator.fragment.graphql'
fragment ReviewPart on Review {
  id
  comment
  rating
  photos {
    id
    original
    thumbnail
  }
  user {
    id
    name
  }
  user_id
  product {
    id
    name
    slug
    ratings
    price
    language
    image {
      id
      original
      thumbnail
    }
  }
  product_id
  shop_id
  feedbacks {
    id
    user_id
    positive
    negative
  }
  positive_feedbacks_count
  abusive_reports_count
  negative_feedbacks_count
  my_feedback {
    id
    user_id
    positive
    negative
  }
  created_at
  updated_at
}

query Reviews(
  $product_id: ID
  $shop_id: ID
  $rating: Int
  $first: Int
  $orderBy: [QueryReviewsOrderByOrderByClause!]
  $page: Int
) {
  reviews(
    product_id: $product_id
    orderBy: $orderBy
    rating: $rating
    shop_id: $shop_id
    first: $first
    page: $page
  ) {
    data {
      ...ReviewPart
    }
    paginatorInfo {
      ...PaginatorParts
    }
  }
}

query Review($id: ID) {
  review(id: $id) {
    ...ReviewPart
    abusive_reports {
      message
      model_type
      user {
        name
        email
      }
      created_at
    }
  }
}

mutation DeleteReview($id: ID!) {
  deleteReview(id: $id) {
    ...ReviewPart
  }
}

mutation DeclineReview($input: AcceptAbusiveReportInput!) {
  rejectAbusiveReport(input: $input) {
    id
  }
}
mutation CreateAbuseReport($input: CreateAbusiveReportInput!) {
  createAbusiveReport(input: $input) {
    model_id
    message
  }
}
