use crate::{builder::ClientLinkSettings, traits::VecExt};
use graph_core::resource::ResourceIdentity;
use std::collections::{BTreeMap, BTreeSet};
// attachments
pub fn get_client_link_settings(
    resource_identity: ResourceIdentity,
) -> BTreeMap<String, BTreeSet<ClientLinkSettings>> {
    let mut map: BTreeMap<String, Vec<ClientLinkSettings>> = BTreeMap::new();

    match resource_identity {
        ResourceIdentity::Admin => {
            map.insert(
                "admin".into(),
                vec![ClientLinkSettings::new("serviceAnnouncement")
                    .use_method_name("service_announcement")
                    .with_extend_path_ident()
                    .with_set_resource_identity()]
                .mem_take(),
            );
        }
        ResourceIdentity::Application | ResourceIdentity::Applications => {
            map.insert(
                "applications".into(),
                vec![ClientLinkSettings::new("applicationsId").as_id_method_link()].mem_take(),
            );
        }
        ResourceIdentity::Attachments => {
            map.insert(
                "attachments".into(),
                vec![ClientLinkSettings::new("attachmentsId").as_id_method_link()].mem_take(),
            );
        }
        ResourceIdentity::Activities => {
            map.insert(
                "activities".into(),
                vec![ClientLinkSettings::new("activitiesId").as_id_method_link()].mem_take(),
            );
        }
        ResourceIdentity::Buckets => {
            map.insert(
                "buckets".into(),
                vec![ClientLinkSettings::new("bucketsId").as_id_method_link()].mem_take(),
            );

            map.insert(
                "bucketsId".into(),
                vec![
                    ClientLinkSettings::new("tasks")
                        .use_method_name("tasks")
                        .with_extend_path_ident()
                        .with_resource_identity(ResourceIdentity::Buckets),
                    ClientLinkSettings::new("tasksId")
                        .use_method_name("task")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_resource_identity(ResourceIdentity::Buckets),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Calendar | ResourceIdentity::Calendars => {
            map.insert(
                "calendar".into(),
                vec![
                    ClientLinkSettings::new("calendarView")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarViews")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendars").as_id_method_link(),
                    ClientLinkSettings::new("event")
                        .use_method_name("events")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("events")
                        .use_method_name("event")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
            map.insert(
                "calendars".into(),
                vec![
                    ClientLinkSettings::new("calendarView")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarViews")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("event")
                        .use_method_name("events")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("events")
                        .use_method_name("event")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("extendedProperties")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::CalendarGroup | ResourceIdentity::CalendarGroups => {
            map.insert(
                "calendarGroup".into(),
                vec![
                    ClientLinkSettings::new("calendar")
                        .use_method_name("calendars")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarGroups").as_id_method_link(),
                    ClientLinkSettings::new("calendars")
                        .use_method_name("calendar")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("event")
                        .use_method_name("events")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("events")
                        .use_method_name("event")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
            map.insert(
                "calendarGroups".into(),
                vec![
                    ClientLinkSettings::new("calendar")
                        .use_method_name("calendars")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendars")
                        .use_method_name("calendar")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("event")
                        .use_method_name("events")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("events")
                        .use_method_name("event")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::CalendarView | ResourceIdentity::CalendarViews => {
            map.insert(
                "calendarView".into(),
                vec![
                    ClientLinkSettings::new("attachment")
                        .use_method_name("attachments")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("attachments")
                        .use_method_name("attachment")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendar")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("extendedProperties")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("instance")
                        .use_method_name("instances")
                        .with_extend_path_id()
                        .with_extend_path_ident(),
                    ClientLinkSettings::new("instances")
                        .use_method_name("instance")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
            map.insert(
                "calendarViews".into(),
                vec![ClientLinkSettings::new("calendarView").as_id_method_link()].mem_take(),
            );
        }
        ResourceIdentity::CallRecords => {
            map.insert(
                "callRecord".into(),
                vec![ClientLinkSettings::new("callRecords").as_id_method_link()].mem_take(),
            );
            map.insert(
                "callRecords".into(),
                vec![
                    ClientLinkSettings::new("session")
                        .use_method_name("sessions")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("sessions")
                        .use_method_name("session")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::ChildFolders => {
            map.insert(
                "childFolders".into(),
                vec![
                    ClientLinkSettings::new("message")
                        .use_method_name("messages")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("messages")
                        .use_method_name("message")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Communications => {
            map.insert(
                "communications".into(),
                vec![
                    ClientLinkSettings::new("call")
                        .use_method_name("calls")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("callRecord")
                        .use_method_name("callRecords")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("callRecords")
                        .use_method_name("callRecord")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calls")
                        .use_method_name("call")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::ContactFolders => {
            map.insert(
                "contactFolders".into(),
                vec![
                    ClientLinkSettings::new("childFolder")
                        .use_method_name("childFolders")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("childFolders")
                        .use_method_name("childFolder")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("contact")
                        .use_method_name("contacts")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("contacts")
                        .use_method_name("contact")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("extendedProperties")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Contacts => {
            map.insert(
                "contacts".into(),
                vec![ClientLinkSettings::new("extendedProperties")
                    .with_extend_path_id()
                    .with_extend_path_ident()
                    .with_set_resource_identity()]
                .mem_take(),
            );
        }
        ResourceIdentity::Conversations => {
            map.insert(
                "conversations".into(),
                vec![
                    ClientLinkSettings::new("extendedProperties")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("thread")
                        .use_method_name("threads")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("threads")
                        .use_method_name("thread")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Drive | ResourceIdentity::Drives => {
            map.insert(
                "drive".into(),
                vec![
                    ClientLinkSettings::new("item")
                        .use_method_name("items")
                        .with_extend_path_ident(),
                    ClientLinkSettings::new("list")
                        .use_method_name("lists")
                        .with_extend_path_ident(),
                ]
                .mem_take(),
            );
            map.insert(
                "drives".into(),
                vec![
                    ClientLinkSettings::new("item")
                        .use_method_name("items")
                        .use_custom("self.transfer_identity();\n"),
                    ClientLinkSettings::new("items")
                        .use_method_name("item")
                        .use_custom("self.transfer_identity();\n")
                        .with_id_param()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("list")
                        .use_method_name("lists")
                        .use_custom("self.transfer_identity();\n")
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("lists")
                        .use_method_name("list")
                        .use_custom("self.transfer_identity();\n")
                        .with_id_param()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Events => {
            map.insert(
                "events".into(),
                vec![
                    ClientLinkSettings::new("attachment")
                        .use_method_name("attachments")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("attachments")
                        .use_method_name("attachment")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendar")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("extendedProperties")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("instance")
                        .use_method_name("instances")
                        .with_extend_path_id()
                        .with_extend_path_ident(),
                    ClientLinkSettings::new("instances")
                        .use_method_name("instance")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Groups => {
            map.insert(
                "groups".into(),
                vec![
                    ClientLinkSettings::new("calendar")
                        .use_method_name("calendars")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarGroup")
                        .use_method_name("calendarGroups")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarGroups")
                        .use_method_name("calendarGroup")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarView")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarViews")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendars")
                        .use_method_name("calendar")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("conversation")
                        .use_method_name("conversations")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("conversations")
                        .use_method_name("conversation")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("drives")
                        .use_method_name("drive")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident(),
                    ClientLinkSettings::new("event")
                        .use_method_name("events")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("events")
                        .use_method_name("event")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("onenote")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("planner")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("thread")
                        .use_method_name("threads")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("threads")
                        .use_method_name("thread")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Lists => {
            map.insert(
                "lists".into(),
                vec![
                    ClientLinkSettings::new("contentType")
                        .use_method_name("contentTypes")
                        .with_extend_path_id()
                        .with_extend_path_ident(),
                    ClientLinkSettings::new("contentTypes")
                        .use_method_name("contentType")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident(),
                    ClientLinkSettings::new("item")
                        .use_method_name("items")
                        .with_extend_path_id()
                        .with_extend_path_ident(),
                    ClientLinkSettings::new("items")
                        .use_method_name("item")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::MailFolders => {
            map.insert(
                "mailFolders".into(),
                vec![
                    ClientLinkSettings::new("childFolder")
                        .use_method_name("childFolders")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("childFolders")
                        .use_method_name("childFolder")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("extendedProperties")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("message")
                        .use_method_name("messages")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("messages")
                        .use_method_name("message")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Me => {
            map.insert(
                "me".into(),
                vec![
                    ClientLinkSettings::new("activities")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendar")
                        .use_method_name("calendars")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarGroup")
                        .use_method_name("calendarGroups")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarGroups")
                        .use_method_name("calendarGroup")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarView")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarViews")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendars")
                        .use_method_name("calendar")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("contact")
                        .use_method_name("contacts")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("contactFolder")
                        .use_method_name("contact_folders")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("contactFolders")
                        .use_method_name("contact_folder")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("contacts")
                        .use_method_name("contact")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("drives")
                        .use_method_name("drive")
                        .with_extend_path_ident()
                        .with_new_method_empty_id(),
                    ClientLinkSettings::new("educationMe").use_method_name("education"),
                    ClientLinkSettings::new("event")
                        .use_method_name("events")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("events")
                        .use_method_name("event")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("inferenceClassification")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("insights")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("mailFolder")
                        .use_method_name("mailFolders")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("mailFolders")
                        .use_method_name("mailFolder")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("managedDevice")
                        .use_method_name("managed_devices")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("managedDevices")
                        .use_method_name("managed_device")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("message")
                        .use_method_name("messages")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("messages")
                        .use_method_name("message")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("onenote")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("outlook")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("planner")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("settings")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("agreementAcceptances")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("agreementAcceptancesId")
                        .use_method_name("agreement_acceptance")
                        .with_extend_path_ident()
                        .with_id_param()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Messages => {
            map.insert(
                "messages".into(),
                vec![
                    ClientLinkSettings::new("attachment")
                        .use_method_name("attachments")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("attachments")
                        .use_method_name("attachment")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("extendedProperties")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Notebooks => {
            map.insert(
                "notebooks".into(),
                vec![
                    ClientLinkSettings::new("sectionGroups")
                        .use_method_name("sectionGroup")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("sections")
                        .use_method_name("section")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Onenote => {
            map.insert(
                "onenote".into(),
                vec![
                    ClientLinkSettings::new("notebook")
                        .use_method_name("notebooks")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("notebooks")
                        .use_method_name("notebook")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("page")
                        .use_method_name("pages")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("pages")
                        .use_method_name("page")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("section")
                        .use_method_name("sections")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("sectionGroup")
                        .use_method_name("sectionGroups")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("sectionGroups")
                        .use_method_name("sectionGroup")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("sections")
                        .use_method_name("section")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Pages => {
            map.insert(
                "pages".into(),
                vec![
                    ClientLinkSettings::new("parentNotebook")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("parentSection")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::ParentNotebook => {
            map.insert(
                "parentNotebook".into(),
                vec![
                    ClientLinkSettings::new("sectionGroups")
                        .use_method_name("sectionGroup")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("sections")
                        .use_method_name("section")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::ParentSection => {
            map.insert(
                "parentSection".into(),
                vec![
                    ClientLinkSettings::new("pages")
                        .use_method_name("page")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("parentNotebook")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("parentSectionGroup")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::ParentSectionGroup => {
            map.insert(
                "parentSectionGroup".into(),
                vec![
                    ClientLinkSettings::new("parentNotebook")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("parentSectionGroup").with_extend_path_ident(),
                    ClientLinkSettings::new("sectionGroups")
                        .use_method_name("sectionGroup")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("sections")
                        .use_method_name("section")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Planner => {
            map.insert(
                "planner".into(),
                vec![
                    ClientLinkSettings::new("buckets")
                        .use_method_name("buckets")
                        .with_extend_path_ident()
                        .with_resource_identity(ResourceIdentity::Buckets),
                    ClientLinkSettings::new("bucketsId")
                        .use_method_name("bucket")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_resource_identity(ResourceIdentity::Buckets),
                    ClientLinkSettings::new("plans")
                        .use_method_name("plans")
                        .with_extend_path_ident()
                        .with_resource_identity(ResourceIdentity::Plans),
                    ClientLinkSettings::new("plansId")
                        .use_method_name("plan")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_resource_identity(ResourceIdentity::Plans),
                    ClientLinkSettings::new("tasks")
                        .use_method_name("tasks")
                        .with_extend_path_ident()
                        .with_resource_identity(ResourceIdentity::Tasks),
                    ClientLinkSettings::new("tasksId")
                        .use_method_name("task")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_resource_identity(ResourceIdentity::Tasks),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Plans => {
            map.insert(
                "plansId".into(),
                vec![
                    ClientLinkSettings::new("buckets")
                        .use_method_name("buckets")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_resource_identity(ResourceIdentity::Buckets),
                    ClientLinkSettings::new("bucketsId")
                        .use_method_name("bucket")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_resource_identity(ResourceIdentity::Buckets),
                    ClientLinkSettings::new("tasks")
                        .use_method_name("tasks")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_resource_identity(ResourceIdentity::Tasks),
                    ClientLinkSettings::new("tasksId")
                        .use_method_name("task")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_resource_identity(ResourceIdentity::Tasks),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Posts => {
            map.insert(
                "posts".into(),
                vec![
                    ClientLinkSettings::new("attachment")
                        .use_method_name("attachments")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("attachments")
                        .use_method_name("attachment")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("extendedProperties")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::SectionGroups => {
            map.insert(
                "sectionGroups".into(),
                vec![ClientLinkSettings::new("sections")
                    .use_method_name("section")
                    .with_id_param()
                    .with_extend_path_id()
                    .with_extend_path_ident()
                    .with_set_resource_identity()]
                .mem_take(),
            );
        }
        ResourceIdentity::Sections => {
            map.insert(
                "sections".into(),
                vec![
                    ClientLinkSettings::new("pages")
                        .use_method_name("page")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("parentNotebook")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("parentSectionGroup")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::ServiceAnnouncement => {
            map.insert(
                "serviceAnnouncement".into(),
                vec![
                    ClientLinkSettings::new("message")
                        .use_method_name("messages")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("messages")
                        .use_method_name("message")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("healthOverviews")
                        .use_method_name("health_overviews")
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("healthOverviewsId")
                        .use_method_name("health_overview")
                        .with_id_param()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Sites => {
            map.insert(
                "sites".into(),
                vec![
                    ClientLinkSettings::new("contentType")
                        .use_method_name("contentTypes")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("contentTypes")
                        .use_method_name("contentType")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("drives")
                        .use_method_name("drive")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_new_method_empty_id(),
                    ClientLinkSettings::new("list")
                        .use_method_name("lists")
                        .with_extend_path_id()
                        .with_extend_path_ident(),
                    ClientLinkSettings::new("lists")
                        .use_method_name("list")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("onenote")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Threads => {
            map.insert(
                "threads".into(),
                vec![
                    ClientLinkSettings::new("post")
                        .use_method_name("posts")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("posts")
                        .use_method_name("post")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        ResourceIdentity::Users => {
            map.insert(
                "user".into(),
                vec![ClientLinkSettings::new("educationUsers").use_method_name("education")]
                    .mem_take(),
            );
            map.insert(
                "users".into(),
                vec![
                    ClientLinkSettings::new("activities")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendar")
                        .use_method_name("calendars")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarGroup")
                        .use_method_name("calendarGroups")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarGroups")
                        .use_method_name("calendarGroup")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarView")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendarViews")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("calendars")
                        .use_method_name("calendar")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("contact")
                        .use_method_name("contacts")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("contactFolder")
                        .use_method_name("contact_folders")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("contactFolders")
                        .use_method_name("contact_folder")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("contacts")
                        .use_method_name("contact")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("drives")
                        .use_method_name("drive")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_new_method_empty_id(),
                    ClientLinkSettings::new("event")
                        .use_method_name("events")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("events")
                        .use_method_name("event")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("inferenceClassification")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("insights")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("mailFolder")
                        .use_method_name("mailFolders")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("mailFolders")
                        .use_method_name("mailFolder")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("managedDevice")
                        .use_method_name("managed_devices")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("managedDevices")
                        .use_method_name("managed_device")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("message")
                        .use_method_name("messages")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("messages")
                        .use_method_name("message")
                        .with_id_param()
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("onenote")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("outlook")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("planner")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("settings")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("agreementAcceptances")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_set_resource_identity(),
                    ClientLinkSettings::new("agreementAcceptancesId")
                        .use_method_name("agreement_acceptance")
                        .with_extend_path_id()
                        .with_extend_path_ident()
                        .with_id_param()
                        .with_set_resource_identity(),
                ]
                .mem_take(),
            );
        }
        _ => {}
    }
    map.into_iter()
        .map(|(name, vec)| {
            let mut set = BTreeSet::new();
            set.extend(vec);
            (name, set)
        })
        .collect()
}
