import { Items } from './Item'

interface Props {
    map(arg0: (rows: any) => string): unknown;
    title: string,
    atom_link: string,
    email: string,
    nameCompanies: string,
    description: string,
    webSite: string,
    urlImg: string,
    lastBuildDate: string
}

export const getRssXml = (data: Props) => {
        let item =`
        <rss version="2.0"
          xmlns:atom="http://www.w3.org/2005/Atom"
          xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0/play-podcasts.xsd"
          xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
          xmlns:content="http://purl.org/rss/1.0/modules/content/"
          xmlns:media="http://search.yahoo.com/mrss/"
          xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
        >
        <channel>
            <title>`+data.title+`</title>
            <atom:link href="`+data.atom_link+`" rel="self" type="application/rss+xml"/>
            <googleplay:owner>`+data.email+`</googleplay:owner>
            <itunes:owner>
                <itunes:name>`+data.nameCompanies+`</itunes:name>
                <itunes:email>`+data.email+`</itunes:email>
            </itunes:owner>
            <googleplay:author>`+data.nameCompanies+`</googleplay:author>
            <itunes:author>`+data.nameCompanies+`</itunes:author>
            <description>`+data.description+`</description>
            <googleplay:description>`+data.description+`</googleplay:description>
            <itunes:summary>`+data.description+`</itunes:summary>
            <image>
                <link>`+data.webSite+`</link>
                <title>`+data.nameCompanies+`</title>
                <url>`+data.webSite+'/'+data.urlImg+`</url>
            </image>
            <googleplay:image href="`+data.webSite+'/'+data.urlImg+`"/>
            <itunes:image href="`+data.webSite+'/'+data.urlImg+`"/>
            <itunes:category text="Society &amp; Culture">
                <itunes:category text="Places &amp; Travel"/>
            </itunes:category>
            <itunes:category text="Science">
                <itunes:category text="Social Sciences"/>
            </itunes:category>
            <language>ru</language>
            <link>`+data.webSite+`</link>
            <copyright>© 2022 `+data.nameCompanies+`</copyright>
            <itunes:type>episodic</itunes:type>
            <googleplay:explicit>no</googleplay:explicit>
            <itunes:explicit>no</itunes:explicit>
            <lastBuildDate>`+data.lastBuildDate+`</lastBuildDate>
            <googleplay:block>yes</googleplay:block>`;
      return(item)
};

