---
- name: Create config directory
  file:
    path: '{{ item }}'
    mode: '755'
    state: directory
  loop:
    - '{{ xdg_dir.config_home }}/calcurse'
    - '{{ xdg_dir.config_home }}/calcurse/caldav'
    - '{{ xdg_dir.config_home }}/calcurse/hooks'

- name: Copy config templates
  template:
    src: 'calcurse/{{ item.src }}.j2'
    dest: '{{ xdg_dir.config_home }}/calcurse/{{ item.dest }}'
    mode: '644'
  loop:
    - src: caldav_config
      dest: caldav/config
    - src: conf
      dest: conf

- name: Copy hook scripts
  ansible.posix.synchronize:
    src: 'calcurse/hooks/'
    dest: '{{ xdg_dir.config_home }}/calcurse/hooks/'
    recursive: true
