# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/BasicInputs/Geology/CShoe.f90"
module CShoe
    use SimulationVariables
    use json_module

    implicit none    
    public    
    contains

	subroutine ShoeFromJson(parent)
		use json_module,IK =>json_ik
        type(json_value),pointer :: parent
        type(json_core) :: json
        type(json_value),pointer :: p,pitem,pval
		logical::is_found
		integer::i,n_children
		CHARACTER(KIND=JSON_CK, LEN=:), ALLOCATABLE :: val


        call json%get(parent,'Shoe',p)

		call json%get(p,'FormationNo',pval)
		call json%get(pval,data%Configuration%Shoe%FormationNo)
		call json%get(p,'ShoeDepth',pval)
		call json%get(pval,data%Configuration%Shoe%ShoeDepth)
		call json%get(p,'LeakOff',pval)
		call json%get(pval,data%Configuration%Shoe%LeakOff)
		call json%get(p,'Breakdown',pval)
		call json%get(pval,data%Configuration%Shoe%Breakdown)
		call json%get(p,'FracturePropagation',pval)
		call json%get(pval,data%Configuration%Shoe%FracturePropagation)
		call json%get(p,'InactiveFracture',pval)
		call json%get(pval,data%Configuration%Shoe%InactiveFracture)
    end subroutine

    subroutine ShoeToJson(parent)

        type(json_value),pointer :: parent
        type(json_core) :: json
        type(json_value),pointer :: p

! 1. create new node
        call json%create_object(p,'Shoe')
        
! 2. add member of data type to new node
        call json%add(p,"Breakdown",data%Configuration%Shoe%Breakdown)
        call json%add(p,"FormationNo",data%Configuration%Shoe%FormationNo)
        call json%add(p,"FracturePropagation",data%Configuration%Shoe%FracturePropagation)
        call json%add(p,"InactiveFracture",data%Configuration%Shoe%InactiveFracture)
        call json%add(p,"LeakOff",data%Configuration%Shoe%LeakOff)
        call json%add(p,"ShoeDepth",data%Configuration%Shoe%ShoeDepth)

! 3. add new node to parent
        call json%add(parent,p)
    end subroutine

end module CShoe