
import { oneProperties } from '@/actions/bmv'
import EditVillas from '@/components/bmv/villas/edit-villas'
import MainContent from '@/components/sidebar/main-content'
import SidebarApp from '@/components/sidebar/sidebar-app'
import SidebarWrapper from '@/components/sidebar/sidebar-wrapper'
import SiteHeader from '@/components/sidebar/site-header'

export default async function page({params} : { params: Promise<{ id: string }>}) {

    const id = (await params).id

    const res = await oneProperties(id)
    const error = res.success ? false : true;
    const villa = res.success ? res.data : [];

    return (
        <div className="[--header-height:calc(--spacing(14))]">
            <SidebarWrapper>
                <div className="flex flex-1">
                    <SidebarApp/>
                    <MainContent>
                        <SiteHeader/>
                        <div className="flex flex-1 flex-col gap-6 lg:px-14 px-4 py-8 bg-gundam-gray/30">
                            <EditVillas 
                                error={error}
                                villa={villa}
                            />
                        </div>
                    </MainContent>
                </div>
            </SidebarWrapper>
        </div>
    )
}
