# import PaginatorParts from './paginator.fragment.graphql'
# import ShopParts from './shops.graphql'
# import MeParts from './me.graphql'

fragment MessageParts on Message {
  body
  conversation_id
  created_at
  updated_at
  user_id
  id
}

query Conversations(
  $orderBy: String
  $sortedBy: String
  $first: Int
  $page: Int
  $search: String
) {
  conversations(
    orderBy: $orderBy
    sortedBy: $sortedBy
    first: $first
    page: $page
    search: $search
  ) {
    data {
      user_id
      id
      shop_id
      unseen
      created_at
      updated_at
      shop {
        ...ShopParts
      }
      user {
        ...MeParts
      }
      latest_message {
        ...MessageParts
      }
    }
    paginatorInfo {
      ...PaginatorParts
    }
  }
}

query Conversation($conversation_id: ID!) {
  conversation(id: $conversation_id) {
    shop {
      ...ShopParts
    }
    unseen
  }
}

mutation CreateConversation($input: CreateConversationInput!) {
  createConversation(input: $input) {
    id
  }
}
