<commit_before>class AppointmentTicket
  ZENDESK_API_URL = 'https://pensionwise.zendesk.com/api/v2'
  ZENDESK_ONLINE_BOOKING_GROUP = 24_532_022

  def initialize(appointment)
    @appointment = appointment
  end

  def create!
    client.tickets.create(
      type: 'task',
      group_id: ZENDESK_ONLINE_BOOKING_GROUP,
      subject: 'Pension Wise appointment request',
      requester: requester,
      comment: comment)
  end

  private

  def client
    ZendeskAPI::Client.new do |config|
      config.url = ZENDESK_API_URL
      config.username = ENV['ZENDESK_API_USERNAME']
      config.token = ENV['ZENDESK_API_TOKEN']
    end
  end

  def requester
    { name: @appointment.full_name, email: @appointment.email }
  end

  def comment
    <<-TEXT.strip_heredoc
      New appointment request

      Name:
      #{@appointment.full_name}

      Date:
      #{@appointment.date}

      Time:
      #{@appointment.time}

      Appointment type:
      #{@appointment.kind}

      #{info}

      Phone number:
      #{@appointment.phone}

      Email:
      #{@appointment.email}
    TEXT
  end

  def info
    case @appointment.type
    when 'phone'
      <<-TEXT.strip_heredoc
        Memorable word:
        #{@appointment.memorable_word}
      TEXT
    when 'face-to-face'
      <<-TEXT.strip_heredoc
        Postcode:
        #{@appointment.postcode}
      TEXT
    end
  end
end<commit_msg>Revert "Remove internal note from appointment ticket"<commit_after>class AppointmentTicket
  ZENDESK_API_URL = 'https://pensionwise.zendesk.com/api/v2'
  ZENDESK_ONLINE_BOOKING_GROUP = 24_532_022

  def initialize(appointment)
    @appointment = appointment
  end

  def create!
    client.tickets.create(
      type: 'task',
      group_id: ZENDESK_ONLINE_BOOKING_GROUP,
      subject: 'Pension Wise appointment request',
      requester: requester,
      comment: comment)
  end

  private

  def client
    ZendeskAPI::Client.new do |config|
      config.url = ZENDESK_API_URL
      config.username = ENV['ZENDESK_API_USERNAME']
      config.token = ENV['ZENDESK_API_TOKEN']
    end
  end

  def requester
    { name: @appointment.full_name, email: @appointment.email }
  end

  def comment
    <<-TEXT.strip_heredoc
      New appointment request

      Name:
      #{@appointment.full_name}

      Date:
      #{@appointment.date}

      Time:
      #{@appointment.time}

      Appointment type:
      #{@appointment.kind}

      #{info}

      Phone number:
      #{@appointment.phone}

      Email:
      #{@appointment.email}

      Please confirm the appointment with the customer
    TEXT
  end

  def info
    case @appointment.type
    when 'phone'
      <<-TEXT.strip_heredoc
        Memorable word:
        #{@appointment.memorable_word}
      TEXT
    when 'face-to-face'
      <<-TEXT.strip_heredoc
        Postcode:
        #{@appointment.postcode}
      TEXT
    end
  end
end
{'fraction_non_alphanumeric': 0.09411764705882353, 'fraction_numerical': 0.006228373702422145, 'mean_word_length': 2.4705882352941178, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3796197', 'n_tokens_mistral': 1003, 'n_tokens_neox': 973, 'n_words': 196}