package com.yunfeiyun.agmp.common.core.domain.model;

import com.yunfeiyun.agmp.common.constant.ResConstants;
import com.yunfeiyun.agmp.common.web.system.domain.SysRes;

import java.io.Serializable;

public class PortalTheme  implements Serializable , IBaseTheme {

    private String themeId;
    private String themeName;
    private String systemName;
    private String copyright;
    private String logoUrl;
    @Override
    public String getThemeId() {
        return themeId;
    }
    @Override
    public void setThemeId(String themeId) {
        this.themeId = themeId;
    }
    @Override
    public String getThemeName() {
        return themeName;
    }
    @Override
    public void setThemeName(String themeName) {
        this.themeName = themeName;
    }
    @Override
    public String getCopyright() {
        return copyright;
    }
    @Override
    public void setCopyright(String copyright) {
        this.copyright = copyright;
    }
    @Override
    public String getSystemName() {
        return systemName;
    }

    @Override
    public void setSystemName(String systemName) {
        this.systemName = systemName;
    }

    @Override
    public String getLogoUrl() {
        return logoUrl;
    }
    @Override
    public void setLogoUrl(String logoUrl) {
        this.logoUrl = logoUrl;
    }
    public static PortalTheme build(AbstractTheme theme){
        PortalTheme portal = new PortalTheme();
        portal.setThemeId( theme.getThemeId() );
        portal.setThemeName( theme.getThemeName() );
        portal.setSystemName( theme.getSystemName() );
        portal.setCopyright( theme.getCopyright() );
        SysRes.add( theme.getResList() , ResConstants.formType.ADD);
        if(theme.getResList() !=null && theme.getResList().size() >0){
            SysRes uploadRes = theme.getResList().get(0);
            portal.setLogoUrl( uploadRes.getResUrl() );
        }
        return portal;
    }
}
