{
  "version": 1,
  "profile": "mobile",
  "app": {
    "name": {
      "en": "Social posts",
      "ar": "منشورات التواصل"
    },
    "apiBase": "/api/v1",
    "defaultRoute": "/home",
    "notFound": "lost",
    "locales": [
      "en",
      "ar"
    ],
    "defaultLocale": "en",
    "dateFormat": "DD/MM/YYYY",
    "timeFormat": "12",
    "navigation": "tabs",
    "words": {
      "en": {
        "empty": "No posts yet"
      },
      "ar": {
        "empty": "لا منشورات بعد"
      }
    }
  },
  "theme": {
    "brand": "oncloud",
    "defaultMode": "system"
  },
  "resources": {
    "post": {
      "endpoint": "/posts",
      "key": "id",
      "label": {
        "en": "Post",
        "ar": "منشور"
      },
      "titleField": "caption",
      "fields": {
        "id": {
          "type": "string",
          "readOnly": true,
          "label": {
            "en": "Post",
            "ar": "المنشور"
          }
        },
        "media": {
          "type": "file",
          "multiple": true,
          "accept": "image/*,video/*",
          "label": {
            "en": "Photos and videos",
            "ar": "الصور والفيديو"
          },
          "help": {
            "en": "One or more. A carousel keeps this order.",
            "ar": "واحد أو أكثر. يُحفظ الترتيب كما هو."
          },
          "rules": {
            "required": true
          }
        },
        "caption": {
          "type": "text",
          "label": {
            "en": "Caption",
            "ar": "النص"
          },
          "placeholder": {
            "en": "What will the post say?",
            "ar": "ماذا سيقول المنشور؟"
          },
          "rules": {
            "maxLength": 5000
          }
        },
        "postAt": {
          "type": "date",
          "mode": "datetime",
          "label": {
            "en": "Posting date",
            "ar": "تاريخ النشر"
          },
          "rules": {
            "required": true
          }
        },
        "platforms": {
          "type": "enum",
          "multiple": true,
          "label": {
            "en": "Platforms",
            "ar": "المنصات"
          },
          "options": [
            {
              "value": "instagram",
              "label": {
                "en": "Instagram",
                "ar": "إنستغرام"
              }
            },
            {
              "value": "x",
              "label": {
                "en": "X",
                "ar": "إكس"
              }
            },
            {
              "value": "linkedin",
              "label": {
                "en": "LinkedIn",
                "ar": "لينكدإن"
              }
            },
            {
              "value": "tiktok",
              "label": {
                "en": "TikTok",
                "ar": "تيك توك"
              }
            },
            {
              "value": "facebook",
              "label": {
                "en": "Facebook",
                "ar": "فيسبوك"
              }
            },
            {
              "value": "snapchat",
              "label": {
                "en": "Snapchat",
                "ar": "سناب شات"
              }
            },
            {
              "value": "youtube",
              "label": {
                "en": "YouTube",
                "ar": "يوتيوب"
              }
            }
          ]
        },
        "status": {
          "type": "enum",
          "label": {
            "en": "Status",
            "ar": "الحالة"
          },
          "options": [
            {
              "value": "draft",
              "label": {
                "en": "Draft",
                "ar": "مسودة"
              },
              "tone": "gray"
            },
            {
              "value": "scheduled",
              "label": {
                "en": "Scheduled",
                "ar": "مجدول"
              },
              "tone": "blue"
            },
            {
              "value": "posted",
              "label": {
                "en": "Posted",
                "ar": "منشور"
              },
              "tone": "green"
            }
          ],
          "default": "scheduled",
          "rules": {
            "required": true
          }
        },
        "createdAt": {
          "type": "date",
          "mode": "datetime",
          "readOnly": true,
          "label": {
            "en": "Added",
            "ar": "أُضيف"
          }
        },
        "updatedAt": {
          "type": "date",
          "mode": "datetime",
          "readOnly": true,
          "label": {
            "en": "Changed",
            "ar": "عُدّل"
          }
        }
      }
    },
    "postEdit": {
      "endpoint": "/posts/:id",
      "key": "id",
      "label": {
        "en": "Post",
        "ar": "منشور"
      },
      "titleField": "caption",
      "fields": {
        "id": {
          "type": "string",
          "readOnly": true,
          "label": {
            "en": "Post",
            "ar": "المنشور"
          }
        },
        "media": {
          "type": "file",
          "multiple": true,
          "accept": "image/*,video/*",
          "label": {
            "en": "Photos and videos",
            "ar": "الصور والفيديو"
          },
          "help": {
            "en": "One or more. A carousel keeps this order.",
            "ar": "واحد أو أكثر. يُحفظ الترتيب كما هو."
          },
          "rules": {
            "required": true
          }
        },
        "caption": {
          "type": "text",
          "label": {
            "en": "Caption",
            "ar": "النص"
          },
          "placeholder": {
            "en": "What will the post say?",
            "ar": "ماذا سيقول المنشور؟"
          },
          "rules": {
            "maxLength": 5000
          }
        },
        "postAt": {
          "type": "date",
          "mode": "datetime",
          "label": {
            "en": "Posting date",
            "ar": "تاريخ النشر"
          },
          "rules": {
            "required": true
          }
        },
        "platforms": {
          "type": "enum",
          "multiple": true,
          "label": {
            "en": "Platforms",
            "ar": "المنصات"
          },
          "options": [
            {
              "value": "instagram",
              "label": {
                "en": "Instagram",
                "ar": "إنستغرام"
              }
            },
            {
              "value": "x",
              "label": {
                "en": "X",
                "ar": "إكس"
              }
            },
            {
              "value": "linkedin",
              "label": {
                "en": "LinkedIn",
                "ar": "لينكدإن"
              }
            },
            {
              "value": "tiktok",
              "label": {
                "en": "TikTok",
                "ar": "تيك توك"
              }
            },
            {
              "value": "facebook",
              "label": {
                "en": "Facebook",
                "ar": "فيسبوك"
              }
            },
            {
              "value": "snapchat",
              "label": {
                "en": "Snapchat",
                "ar": "سناب شات"
              }
            },
            {
              "value": "youtube",
              "label": {
                "en": "YouTube",
                "ar": "يوتيوب"
              }
            }
          ]
        },
        "status": {
          "type": "enum",
          "label": {
            "en": "Status",
            "ar": "الحالة"
          },
          "options": [
            {
              "value": "draft",
              "label": {
                "en": "Draft",
                "ar": "مسودة"
              },
              "tone": "gray"
            },
            {
              "value": "scheduled",
              "label": {
                "en": "Scheduled",
                "ar": "مجدول"
              },
              "tone": "blue"
            },
            {
              "value": "posted",
              "label": {
                "en": "Posted",
                "ar": "منشور"
              },
              "tone": "green"
            }
          ],
          "default": "scheduled",
          "rules": {
            "required": true
          }
        }
      }
    }
  },
  "screens": {
    "home": {
      "kind": "home",
      "title": {
        "en": "Social posts",
        "ar": "منشورات التواصل"
      },
      "cards": [
        {
          "kind": "summary",
          "label": {
            "en": "Scheduled",
            "ar": "مجدولة"
          },
          "endpoint": "/summary",
          "value": "scheduled",
          "format": "number",
          "caption": "next",
          "icon": "calendar",
          "action": "go.posts"
        },
        {
          "kind": "summary",
          "label": {
            "en": "Drafts",
            "ar": "مسودات"
          },
          "endpoint": "/summary",
          "value": "drafts",
          "format": "number",
          "icon": "note",
          "tone": "amber",
          "action": "go.posts"
        },
        {
          "kind": "summary",
          "label": {
            "en": "Posted",
            "ar": "منشورة"
          },
          "endpoint": "/summary",
          "value": "posted",
          "format": "number",
          "icon": "check",
          "tone": "green",
          "action": "go.posts"
        }
      ],
      "actions": [
        "post.create",
        "go.posts",
        "calendar.add",
        "backup.export",
        "backup.import"
      ]
    },
    "posts": {
      "kind": "list",
      "title": {
        "en": "Posts",
        "ar": "المنشورات"
      },
      "resource": "post",
      "item": {
        "title": "caption",
        "subtitle": {
          "field": "postAt",
          "format": "datetime"
        },
        "badge": "status",
        "image": "media",
        "icon": "image"
      },
      "open": "/posts/:id",
      "pageSize": 20,
      "actions": [
        "post.create"
      ],
      "empty": {
        "title": {
          "en": "No posts yet",
          "ar": "لا منشورات بعد"
        },
        "body": {
          "en": "Add a photo or video, its caption and when it goes out.",
          "ar": "أضف صورة أو فيديو ونصه وموعد نشره."
        }
      }
    },
    "post": {
      "kind": "record",
      "resource": "post",
      "sections": [
        {
          "kind": "media",
          "field": "media"
        },
        {
          "kind": "actions",
          "actions": [
            "post.share",
            "post.copy",
            "post.posted",
            "post.edit",
            "post.delete"
          ]
        },
        {
          "kind": "fields",
          "fields": [
            "caption",
            {
              "field": "postAt",
              "format": "datetime"
            },
            "status",
            "platforms"
          ]
        },
        {
          "kind": "fields",
          "title": {
            "en": "History",
            "ar": "السجل"
          },
          "fields": [
            {
              "field": "createdAt",
              "format": "datetime"
            },
            {
              "field": "updatedAt",
              "format": "datetime"
            }
          ]
        }
      ]
    },
    "postNew": {
      "kind": "form",
      "title": {
        "en": "New post",
        "ar": "منشور جديد"
      },
      "resource": "post",
      "fields": [
        "media",
        "caption",
        "postAt",
        "platforms",
        "status"
      ],
      "submit": {
        "en": "Save post",
        "ar": "احفظ المنشور"
      },
      "then": {
        "navigate": "/posts/:id",
        "replace": true,
        "toast": {
          "en": "Post saved",
          "ar": "تم حفظ المنشور"
        }
      }
    },
    "postEdit": {
      "kind": "form",
      "title": {
        "en": "Edit post",
        "ar": "تعديل المنشور"
      },
      "resource": "postEdit",
      "method": "PATCH",
      "prefill": true,
      "fields": [
        "media",
        "caption",
        "postAt",
        "platforms",
        "status"
      ],
      "submit": {
        "en": "Save",
        "ar": "حفظ"
      },
      "then": {
        "back": true,
        "toast": {
          "en": "Changes saved",
          "ar": "تم حفظ التغييرات"
        }
      }
    },
    "lost": {
      "kind": "message",
      "title": {
        "en": "Not found",
        "ar": "غير موجود"
      },
      "param": "status",
      "variants": {
        "default": {
          "title": {
            "en": "This page does not exist",
            "ar": "هذه الصفحة غير موجودة"
          },
          "icon": "x",
          "actions": [
            "go.home"
          ]
        }
      }
    }
  },
  "routes": [
    {
      "path": "/home",
      "screen": "home"
    },
    {
      "path": "/posts",
      "screen": "posts",
      "children": [
        {
          "path": "/new",
          "screen": "postNew"
        },
        {
          "path": "/:id",
          "screen": "post",
          "children": [
            {
              "path": "/edit",
              "screen": "postEdit"
            }
          ]
        }
      ]
    },
    {
      "path": "/lost",
      "screen": "lost"
    }
  ],
  "menu": [
    {
      "label": {
        "en": "Home",
        "ar": "الرئيسية"
      },
      "route": "/home",
      "icon": "home"
    },
    {
      "label": {
        "en": "Posts",
        "ar": "المنشورات"
      },
      "route": "/posts",
      "icon": "image"
    }
  ],
  "actions": {
    "go.home": {
      "kind": "navigate",
      "label": {
        "en": "Home",
        "ar": "الرئيسية"
      },
      "icon": "home",
      "to": "/home"
    },
    "go.posts": {
      "kind": "navigate",
      "label": {
        "en": "All posts",
        "ar": "كل المنشورات"
      },
      "icon": "image",
      "to": "/posts"
    },
    "post.create": {
      "kind": "navigate",
      "label": {
        "en": "New post",
        "ar": "منشور جديد"
      },
      "icon": "plus",
      "variant": "primary",
      "to": "/posts/new"
    },
    "post.edit": {
      "kind": "navigate",
      "label": {
        "en": "Edit",
        "ar": "تعديل"
      },
      "to": "/posts/:id/edit"
    },
    "post.posted": {
      "kind": "request",
      "label": {
        "en": "Mark as posted",
        "ar": "علّم كمنشور"
      },
      "icon": "check",
      "method": "POST",
      "endpoint": "/posts/:id/posted",
      "optimistic": {
        "field": "status",
        "value": "posted"
      },
      "visibleWhen": {
        "field": "status",
        "notEquals": "posted"
      },
      "then": {
        "toast": {
          "en": "Marked as posted",
          "ar": "تم التعليم كمنشور"
        },
        "refresh": true
      }
    },
    "post.delete": {
      "kind": "request",
      "label": {
        "en": "Delete post",
        "ar": "احذف المنشور"
      },
      "icon": "trash",
      "variant": "danger",
      "method": "DELETE",
      "endpoint": "/posts/:id",
      "confirm": {
        "type": "danger",
        "title": {
          "en": "Delete this post?",
          "ar": "حذف هذا المنشور؟"
        },
        "body": {
          "en": "Its photos and videos are removed from this phone. An export you saved keeps them.",
          "ar": "تُحذف صوره ومقاطعه من هذا الهاتف. يبقى ما حفظته في ملف تصدير."
        },
        "confirmLabel": {
          "en": "Delete",
          "ar": "حذف"
        }
      },
      "then": {
        "navigate": "/posts",
        "replace": true,
        "toast": {
          "en": "Post deleted",
          "ar": "تم حذف المنشور"
        }
      }
    },
    "backup.export": {
      "kind": "download",
      "label": {
        "en": "Export to a file",
        "ar": "صدّر إلى ملف"
      },
      "icon": "arrow-down",
      "endpoint": "/backup",
      "format": "json",
      "filename": "social-posts",
      "then": {
        "toast": {
          "en": "Export saved to your downloads",
          "ar": "تم حفظ التصدير في التنزيلات"
        }
      }
    },
    "backup.import": {
      "kind": "upload",
      "label": {
        "en": "Import from a file",
        "ar": "استورد من ملف"
      },
      "icon": "arrow-up",
      "endpoint": "/backup/import",
      "accept": "application/json,.json",
      "confirm": {
        "title": {
          "en": "Import posts?",
          "ar": "استيراد المنشورات؟"
        },
        "body": {
          "en": "Posts in the file are added. A post already here with the same id is replaced by the file's.",
          "ar": "تُضاف منشورات الملف. المنشور الموجود بنفس المعرّف يُستبدل بنسخة الملف."
        },
        "confirmLabel": {
          "en": "Choose file",
          "ar": "اختر ملفاً"
        }
      },
      "then": {
        "navigate": "/posts",
        "toast": {
          "en": "Posts imported",
          "ar": "تم استيراد المنشورات"
        }
      }
    },
    "post.share": {
      "kind": "share",
      "label": {
        "en": "Share to an app",
        "ar": "شارك إلى تطبيق"
      },
      "icon": "arrow-up",
      "variant": "primary",
      "endpoint": "/posts/:id/share"
    },
    "post.copy": {
      "kind": "share",
      "label": {
        "en": "Copy caption",
        "ar": "انسخ النص"
      },
      "icon": "note",
      "endpoint": "/posts/:id/caption"
    },
    "calendar.add": {
      "kind": "download",
      "label": {
        "en": "Add reminders to calendar",
        "ar": "أضف التذكيرات إلى التقويم"
      },
      "icon": "calendar",
      "endpoint": "/calendar",
      "format": "ics",
      "filename": "social-posts-reminders",
      "then": {
        "toast": {
          "en": "Open the file to add the reminders",
          "ar": "افتح الملف لإضافة التذكيرات"
        }
      }
    }
  }
}
